diff options
author | Eli Zaretskii <eliz@gnu.org> | 2016-03-05 12:12:58 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2016-03-05 12:12:58 +0200 |
commit | bc96f6e827ba079006ae87914395942fc79f3f26 (patch) | |
tree | c980a478b0229057db165de1fec6a40fc56b1f0b /nt | |
parent | ac9a931d595dd83ebac61c6c9cf7388985fee277 (diff) |
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 d7ed92d615..2c72a78b0f 100644 --- a/nt/inc/sys/socket.h +++ b/nt/inc/sys/socket.h @@ -98,6 +98,8 @@ typedef unsigned short uint16_t; #define accept sys_accept #define recvfrom sys_recvfrom #define sendto sys_sendto +#define getaddrinfo sys_getaddrinfo +#define freeaddrinfo sys_freeaddrinfo int sys_socket(int af, int type, int protocol); 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, struct sockaddr *from, int * fromlen); int sys_sendto (int s, const char * buf, int len, int flags, const struct sockaddr *to, int tolen); +int sys_getaddrinfo (const char * node, const char * service, + const struct addrinfo * hints, struct addrinfo ** res); +void sys_freeaddrinfo (struct addrinfo * ai); /* In addition to wrappers for the winsock functions, we also provide an fcntl function, for setting sockets to non-blocking mode. */ diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site index 05034fedd4..ff9df60c27 100644 --- a/nt/mingw-cfg.site +++ b/nt/mingw-cfg.site @@ -68,6 +68,10 @@ ac_cv_func_getsockname=yes ac_cv_func_getpeername=yes # Implemented as sys_socket in w32.c ac_cv_func_socket=yes +# Implemented as sys_getaddrinfo in w32.c +ac_cv_func_getaddrinfo=yes +# Implemented as an inline function in ws2tcpip.h +ac_cv_func_gai_strerror=yes # Implemented in w32.c ac_cv_func_mkostemp=yes ac_cv_func_readlink=yes |