Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*-------------------------------------------------------------------------
 *
 * win32gai_strerror.c
 *    Thread-safe gai_strerror() for Windows.
 *
 * Portions Copyright (c) 2024-2026, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
 *    src/port/win32gai_strerror.c
 *
 *-------------------------------------------------------------------------
 */
 
#include <sys/socket.h>
 
/*
 * Windows has gai_strerrorA(), but it is not thread-safe so we avoid it.
 *
 * https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-gai_strerrora
 */
const char *
gai_strerror(int errcode)
{
    switch (errcode)
    {
        case EAI_AGAIN:
            return "Temporary failure in name resolution";
        case EAI_BADFLAGS:
            return "Bad value for ai_flags";
        case EAI_FAIL:
            return "Non-recoverable failure in name resolution";
        case EAI_FAMILY:
            return "ai_family not supported";
        case EAI_MEMORY:
            return "Memory allocation failure";
        case EAI_NONAME:
            return "Name or service not known";
        case EAI_SERVICE:
            return "Servname not supported for ai_socktype";
        case EAI_SOCKTYPE:
            return "ai_socktype not supported";
        default:
            return "Unknown server error";
    }
}