diff options
| author | Eli Zaretskii | 2016-03-05 12:12:58 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-03-05 12:12:58 +0200 |
| commit | bc96f6e827ba079006ae87914395942fc79f3f26 (patch) | |
| tree | c980a478b0229057db165de1fec6a40fc56b1f0b /nt | |
| parent | ac9a931d595dd83ebac61c6c9cf7388985fee277 (diff) | |
| download | emacs-bc96f6e827ba079006ae87914395942fc79f3f26.tar.gz emacs-bc96f6e827ba079006ae87914395942fc79f3f26.zip | |
Implement getaddrinfo fallback for MS-Windows
See http://lists.gnu.org/archive/html/emacs-devel/2016-02/msg01602.html
for more details.
* nt/mingw-cfg.site (ac_cv_func_getaddrinfo)
(ac_cv_func_gai_strerror): Set to "yes", as the configure script's
test program is not smart enough to auto-detect these.
* nt/inc/sys/socket.h (getaddrinfo, freeaddrinfo): Redirect to
sys_getaddrinfo and sys_freeaddrinfo. Provide prototypes for
sys_getaddrinfo and sys_freeaddrinfo.
* src/w32.c (init_winsock): Try loading getaddrinfo and
freeaddrinfo from ws2_32.dll.
(sys_getaddrinfo, sys_freeaddrinfo): New functions.
* lib-src/pop.c [WINDOWSNT]: Include winsock2.h, not winsock.h,
and also ws2tcpip.h.
(getaddrinfo, freeaddrinfo) [WINDOWSNT]: Redirect to
sys_getaddrinfo and sys_freeaddrinfo, respectively.
(load_ws2, sys_getaddrinfo, sys_freeaddrinfo) [WINDOWSNT]: New
functions.
Diffstat (limited to 'nt')
| -rw-r--r-- | nt/inc/sys/socket.h | 5 | ||||
| -rw-r--r-- | nt/mingw-cfg.site | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h index d7ed92d6158..2c72a78b0f4 100644 --- a/nt/inc/sys/socket.h +++ b/nt/inc/sys/socket.h | |||
| @@ -98,6 +98,8 @@ typedef unsigned short uint16_t; | |||
| 98 | #define accept sys_accept | 98 | #define accept sys_accept |
| 99 | #define recvfrom sys_recvfrom | 99 | #define recvfrom sys_recvfrom |
| 100 | #define sendto sys_sendto | 100 | #define sendto sys_sendto |
| 101 | #define getaddrinfo sys_getaddrinfo | ||
| 102 | #define freeaddrinfo sys_freeaddrinfo | ||
| 101 | 103 | ||
| 102 | int sys_socket(int af, int type, int protocol); | 104 | int sys_socket(int af, int type, int protocol); |
| 103 | int sys_bind (int s, const struct sockaddr *addr, int namelen); | 105 | int sys_bind (int s, const struct sockaddr *addr, int namelen); |
| @@ -118,6 +120,9 @@ int sys_recvfrom (int s, char *buf, int len, int flags, | |||
| 118 | struct sockaddr *from, int * fromlen); | 120 | struct sockaddr *from, int * fromlen); |
| 119 | int sys_sendto (int s, const char * buf, int len, int flags, | 121 | int sys_sendto (int s, const char * buf, int len, int flags, |
| 120 | const struct sockaddr *to, int tolen); | 122 | const struct sockaddr *to, int tolen); |
| 123 | int sys_getaddrinfo (const char * node, const char * service, | ||
| 124 | const struct addrinfo * hints, struct addrinfo ** res); | ||
| 125 | void sys_freeaddrinfo (struct addrinfo * ai); | ||
| 121 | 126 | ||
| 122 | /* In addition to wrappers for the winsock functions, we also provide | 127 | /* In addition to wrappers for the winsock functions, we also provide |
| 123 | an fcntl function, for setting sockets to non-blocking mode. */ | 128 | an fcntl function, for setting sockets to non-blocking mode. */ |
diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site index 05034fedd48..ff9df60c275 100644 --- a/nt/mingw-cfg.site +++ b/nt/mingw-cfg.site | |||
| @@ -68,6 +68,10 @@ ac_cv_func_getsockname=yes | |||
| 68 | ac_cv_func_getpeername=yes | 68 | ac_cv_func_getpeername=yes |
| 69 | # Implemented as sys_socket in w32.c | 69 | # Implemented as sys_socket in w32.c |
| 70 | ac_cv_func_socket=yes | 70 | ac_cv_func_socket=yes |
| 71 | # Implemented as sys_getaddrinfo in w32.c | ||
| 72 | ac_cv_func_getaddrinfo=yes | ||
| 73 | # Implemented as an inline function in ws2tcpip.h | ||
| 74 | ac_cv_func_gai_strerror=yes | ||
| 71 | # Implemented in w32.c | 75 | # Implemented in w32.c |
| 72 | ac_cv_func_mkostemp=yes | 76 | ac_cv_func_mkostemp=yes |
| 73 | ac_cv_func_readlink=yes | 77 | ac_cv_func_readlink=yes |