# HG changeset patch # User Bruno Haible # Date 1223252114 -7200 # Node ID 43282f926709ccda66fe79922b9ddc442ce3762d # Parent 659d4e03768190b22d91e468746ef442c0366493 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,57 @@ +2008-10-05 Bruno Haible + + * modules/accept: New file. + * modules/bind: New file. + * modules/connect: New file. + * modules/getpeername: New file. + * modules/getsockname: New file. + * modules/getsockopt: New file. + * modules/listen: New file. + * modules/recv: New file. + * modules/recvfrom: New file. + * modules/send: New file. + * modules/sendto: New file. + * modules/setsockopt: New file. + * modules/socket: New file. + * lib/sys_socket.in.h: Include the GL_LINK_WARNING definition. + (socket, connect, accept, bind, getpeername, getsockname, getsockopt, + listen, recv, send, recvfrom, sendto, setsockopt): Declare only when + the particular module is requested. Add a link warning when the + particular module is not requested. + * lib/winsock.c (rpl_socket, rpl_connect, rpl_accept, rpl_bind, + rpl_getpeername, rpl_getsockname, rpl_getsockopt, rpl_listen, rpl_recv, + rpl_send, rpl_recvfrom, rpl_sendto, rpl_setsockopt): Define only when + the particular module is requested. + * m4/sys_socket_h.m4 (gl_SYS_SOCKET_MODULE_INDICATOR, + gl_SYS_SOCKET_H_DEFAULTS): New macros. + (gl_HEADER_SYS_SOCKET): Require gl_SYS_SOCKET_H_DEFAULTS. + * modules/sys_socket (Depends-on): Add link-warning. + (Makeifle.am): Substitute GNULIB_SOCKET, GNULIB_CONNECT, GNULIB_ACCEPT, + GNULIB_BIND, GNULIB_GETPEERNAME, GNULIB_GETSOCKNAME, GNULIB_GETSOCKOPT, + GNULIB_LISTEN, GNULIB_RECV, GNULIB_SEND, GNULIB_RECVFROM, + GNULIB_SENDTO, GNULIB_SETSOCKOPT, and the definition of + GL_LINK_WARNING. + * doc/posix-functions/accept.texi: Mention the new module 'accept'. + * doc/posix-functions/bind.texi: Mention the new module 'bind'. + * doc/posix-functions/connect.texi: Mention the new module 'connect'. + * doc/posix-functions/getpeername.texi: Mention the new module + 'getpeername'. + * doc/posix-functions/getsockname.texi: Mention the new module + 'getsockname'. + * doc/posix-functions/getsockopt.texi: Mention the new module + 'getsockopt'. + * doc/posix-functions/listen.texi: Mention the new module 'listen'. + * doc/posix-functions/recv.texi: Mention the new module 'recv'. + * doc/posix-functions/recvfrom.texi: Mention the new module 'recvfrom'. + * doc/posix-functions/send.texi: Mention the new module 'send'. + * doc/posix-functions/sendto.texi: Mention the new module 'sendto'. + * doc/posix-functions/setsockopt.texi: Mention the new module + 'setsockopt'. + * doc/posix-functions/socket.texi: Mention the new module 'socket'. + * modules/poll-tests (Depends-on): Add socket, bind, getsockopt, + listen, connect, accept. + * modules/select-tests (Depends-on): Likewise. + 2008-10-05 Bruno Haible * lib/winsock.c (strerror): Remove unused #undef. diff --git a/doc/posix-functions/accept.texi b/doc/posix-functions/accept.texi --- a/doc/posix-functions/accept.texi +++ b/doc/posix-functions/accept.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/accept.html} -Gnulib module: sys_socket +Gnulib module: accept Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/bind.texi b/doc/posix-functions/bind.texi --- a/doc/posix-functions/bind.texi +++ b/doc/posix-functions/bind.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/bind.html} -Gnulib module: sys_socket +Gnulib module: bind Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/connect.texi b/doc/posix-functions/connect.texi --- a/doc/posix-functions/connect.texi +++ b/doc/posix-functions/connect.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/connect.html} -Gnulib module: sys_socket +Gnulib module: connect Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/getpeername.texi b/doc/posix-functions/getpeername.texi --- a/doc/posix-functions/getpeername.texi +++ b/doc/posix-functions/getpeername.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/getpeername.html} -Gnulib module: sys_socket +Gnulib module: getpeername Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/getsockname.texi b/doc/posix-functions/getsockname.texi --- a/doc/posix-functions/getsockname.texi +++ b/doc/posix-functions/getsockname.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/getsockname.html} -Gnulib module: sys_socket +Gnulib module: getsockname Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/getsockopt.texi b/doc/posix-functions/getsockopt.texi --- a/doc/posix-functions/getsockopt.texi +++ b/doc/posix-functions/getsockopt.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/getsockopt.html} -Gnulib module: sys_socket +Gnulib module: getsockopt Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/listen.texi b/doc/posix-functions/listen.texi --- a/doc/posix-functions/listen.texi +++ b/doc/posix-functions/listen.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/listen.html} -Gnulib module: sys_socket +Gnulib module: listen Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/recv.texi b/doc/posix-functions/recv.texi --- a/doc/posix-functions/recv.texi +++ b/doc/posix-functions/recv.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/recv.html} -Gnulib module: sys_socket +Gnulib module: recv Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/recvfrom.texi b/doc/posix-functions/recvfrom.texi --- a/doc/posix-functions/recvfrom.texi +++ b/doc/posix-functions/recvfrom.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/recvfrom.html} -Gnulib module: sys_socket +Gnulib module: recvfrom Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/send.texi b/doc/posix-functions/send.texi --- a/doc/posix-functions/send.texi +++ b/doc/posix-functions/send.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/send.html} -Gnulib module: sys_socket +Gnulib module: send Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/sendto.texi b/doc/posix-functions/sendto.texi --- a/doc/posix-functions/sendto.texi +++ b/doc/posix-functions/sendto.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/sendto.html} -Gnulib module: sys_socket +Gnulib module: sendto Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/setsockopt.texi b/doc/posix-functions/setsockopt.texi --- a/doc/posix-functions/setsockopt.texi +++ b/doc/posix-functions/setsockopt.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/setsockopt.html} -Gnulib module: sys_socket +Gnulib module: setsockopt Portability problems fixed by Gnulib: @itemize diff --git a/doc/posix-functions/socket.texi b/doc/posix-functions/socket.texi --- a/doc/posix-functions/socket.texi +++ b/doc/posix-functions/socket.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/socket.html} -Gnulib module: sys_socket +Gnulib module: socket Portability problems fixed by Gnulib: @itemize diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -98,6 +98,8 @@ # define SHUT_RDWR SD_BOTH # endif +/* The definition of GL_LINK_WARNING is copied here. */ + # if @HAVE_WINSOCK2_H@ /* Include headers needed by the emulation code. */ # include @@ -105,9 +107,13 @@ typedef int socklen_t; -# ifdef __cplusplus +# endif + +# ifdef __cplusplus extern "C" { -# endif +# endif + +# if @HAVE_WINSOCK2_H@ /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ @@ -128,62 +134,251 @@ # undef FD_ISSET # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) +# endif + /* Wrap everything else to use libc file descriptors for sockets. */ +# if @HAVE_WINSOCK2_H@ # undef close # define close rpl_close +extern int rpl_close(int); +# endif + +# if @GNULIB_SOCKET@ +# if @HAVE_WINSOCK2_H@ +# undef socket +# define socket rpl_socket +extern int rpl_socket (int, int, int protocol); +# endif +# elif @HAVE_WINSOCK2_H@ # undef socket -# define socket rpl_socket +# define socket socket_used_without_requesting_gnulib_module_socket +# elif defined GNULIB_POSIXCHECK +# undef socket +# define socket(d,t,p) \ + (GL_LINK_WARNING ("socket is not always POSIX compliant - " \ + "use gnulib module socket for portability"), \ + socket (d, t, p)) +# endif + +# if @GNULIB_CONNECT@ +# if @HAVE_WINSOCK2_H@ +# undef connect +# define connect rpl_connect +extern int rpl_connect (int, struct sockaddr *, int); +# endif +# elif @HAVE_WINSOCK2_H@ +# undef connect +# define connect socket_used_without_requesting_gnulib_module_connect +# elif defined GNULIB_POSIXCHECK # undef connect -# define connect rpl_connect +# define connect(s,a,l) \ + (GL_LINK_WARNING ("connect is not always POSIX compliant - " \ + "use gnulib module connect for portability"), \ + connect (s, a, l)) +# endif + +# if @GNULIB_ACCEPT@ +# if @HAVE_WINSOCK2_H@ +# undef accept +# define accept rpl_accept +extern int rpl_accept (int, struct sockaddr *, int *); +# endif +# elif @HAVE_WINSOCK2_H@ +# undef accept +# define accept accept_used_without_requesting_gnulib_module_accept +# elif defined GNULIB_POSIXCHECK # undef accept -# define accept rpl_accept +# define accept(s,a,l) \ + (GL_LINK_WARNING ("accept is not always POSIX compliant - " \ + "use gnulib module accept for portability"), \ + accept (s, a, l)) +# endif + +# if @GNULIB_BIND@ +# if @HAVE_WINSOCK2_H@ +# undef bind +# define bind rpl_bind +extern int rpl_bind (int, struct sockaddr *, int); +# endif +# elif @HAVE_WINSOCK2_H@ +# undef bind +# define bind bind_used_without_requesting_gnulib_module_bind +# elif defined GNULIB_POSIXCHECK # undef bind -# define bind rpl_bind +# define bind(s,a,l) \ + (GL_LINK_WARNING ("bind is not always POSIX compliant - " \ + "use gnulib module bind for portability"), \ + bind (s, a, l)) +# endif + +# if @GNULIB_GETPEERNAME@ +# if @HAVE_WINSOCK2_H@ +# undef getpeername +# define getpeername rpl_getpeername +extern int rpl_getpeername (int, struct sockaddr *, int *); +# endif +# elif @HAVE_WINSOCK2_H@ +# undef getpeername +# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername +# elif defined GNULIB_POSIXCHECK # undef getpeername -# define getpeername rpl_getpeername +# define getpeername(s,a,l) \ + (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \ + "use gnulib module getpeername for portability"), \ + getpeername (s, a, l)) +# endif + +# if @GNULIB_GETSOCKNAME@ +# if @HAVE_WINSOCK2_H@ +# undef getsockname +# define getsockname rpl_getsockname +extern int rpl_getsockname (int, struct sockaddr *, int *); +# endif +# elif @HAVE_WINSOCK2_H@ +# undef getsockname +# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname +# elif defined GNULIB_POSIXCHECK # undef getsockname -# define getsockname rpl_getsockname +# define getsockname(s,a,l) \ + (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \ + "use gnulib module getsockname for portability"), \ + getsockname (s, a, l)) +# endif + +# if @GNULIB_GETSOCKOPT@ +# if @HAVE_WINSOCK2_H@ +# undef getsockopt +# define getsockopt rpl_getsockopt +extern int rpl_getsockopt (int, int, int, void *, int *); +# endif +# elif @HAVE_WINSOCK2_H@ +# undef getsockopt +# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt +# elif defined GNULIB_POSIXCHECK # undef getsockopt -# define getsockopt rpl_getsockopt +# define getsockopt(s,lvl,o,v,l) \ + (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \ + "use gnulib module getsockopt for portability"), \ + getsockopt (s, lvl, o, v, l)) +# endif + +# if @GNULIB_LISTEN@ +# if @HAVE_WINSOCK2_H@ +# undef listen +# define listen rpl_listen +extern int rpl_listen (int, int); +# endif +# elif @HAVE_WINSOCK2_H@ # undef listen -# define listen rpl_listen +# define listen listen_used_without_requesting_gnulib_module_listen +# elif defined GNULIB_POSIXCHECK +# undef listen +# define listen(s,b) \ + (GL_LINK_WARNING ("listen is not always POSIX compliant - " \ + "use gnulib module listen for portability"), \ + listen (s, b)) +# endif + +# if @HAVE_WINSOCK2_H@ # undef ioctl # define ioctl rpl_ioctl +extern int rpl_ioctl (int, unsigned long, char *); +# endif + +# if @GNULIB_RECV@ +# if @HAVE_WINSOCK2_H@ +# undef recv +# define recv rpl_recv +extern int rpl_recv (int, void *, int, int); +# endif +# elif @HAVE_WINSOCK2_H@ # undef recv -# define recv rpl_recv +# define recv recv_used_without_requesting_gnulib_module_recv +# elif defined GNULIB_POSIXCHECK +# undef recv +# define recv(s,b,n,f) \ + (GL_LINK_WARNING ("recv is not always POSIX compliant - " \ + "use gnulib module recv for portability"), \ + recv (s, b, n, f)) +# endif + +# if @GNULIB_SEND@ +# if @HAVE_WINSOCK2_H@ +# undef send +# define send rpl_send +extern int rpl_send (int, const void *, int, int); +# endif +# elif @HAVE_WINSOCK2_H@ # undef send -# define send rpl_send +# define send send_used_without_requesting_gnulib_module_send +# elif defined GNULIB_POSIXCHECK +# undef send +# define send(s,b,n,f) \ + (GL_LINK_WARNING ("send is not always POSIX compliant - " \ + "use gnulib module send for portability"), \ + send (s, b, n, f)) +# endif + +# if @GNULIB_RECVFROM@ +# if @HAVE_WINSOCK2_H@ +# undef recvfrom +# define recvfrom rpl_recvfrom +extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *); +# endif +# elif @HAVE_WINSOCK2_H@ # undef recvfrom -# define recvfrom rpl_recvfrom +# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom +# elif defined GNULIB_POSIXCHECK +# undef recvfrom +# define recvfrom(s,b,n,f,a,l) \ + (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \ + "use gnulib module recvfrom for portability"), \ + recvfrom (s, b, n, f, a, l)) +# endif + +# if @GNULIB_SENDTO@ +# if @HAVE_WINSOCK2_H@ +# undef sendto +# define sendto rpl_sendto +extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int); +# endif +# elif @HAVE_WINSOCK2_H@ +# undef sendto +# define sendto sendto_used_without_requesting_gnulib_module_sendto +# elif defined GNULIB_POSIXCHECK # undef sendto -# define sendto rpl_sendto +# define sendto(s,b,n,f,a,l) \ + (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \ + "use gnulib module sendto for portability"), \ + sendto (s, b, n, f, a, l)) +# endif + +# if @GNULIB_SETSOCKOPT@ +# if @HAVE_WINSOCK2_H@ +# undef setsockopt +# define setsockopt rpl_setsockopt +extern int rpl_setsockopt (int, int, int, const void *, int); +# endif +# elif @HAVE_WINSOCK2_H@ # undef setsockopt -# define setsockopt rpl_setsockopt +# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt +# elif defined GNULIB_POSIXCHECK +# undef setsockopt +# define setsockopt(s,lvl,o,v,l) \ + (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \ + "use gnulib module setsockopt for portability"), \ + setsockopt (s, lvl, o, v, l)) +# endif + +# if @HAVE_WINSOCK2_H@ # undef select # define select select_used_without_including_sys_select_h +# endif -extern int rpl_close(int); -extern int rpl_socket (int, int, int protocol); -extern int rpl_connect (int, struct sockaddr *, int); -extern int rpl_accept (int, struct sockaddr *, int *); -extern int rpl_bind (int, struct sockaddr *, int); -extern int rpl_getpeername (int, struct sockaddr *, int *); -extern int rpl_getsockname (int, struct sockaddr *, int *); -extern int rpl_getsockopt (int, int, int, void *, int *); -extern int rpl_listen (int, int); -extern int rpl_ioctl (int, unsigned long, char *); -extern int rpl_recv (int, void *, int, int); -extern int rpl_send (int, const void *, int, int); -extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *); -extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int); -extern int rpl_setsockopt (int, int, int, const void *, int); - -# ifdef __cplusplus +# ifdef __cplusplus } -# endif - -# endif /* HAVE_WINSOCK2_H */ +# endif #endif /* HAVE_SYS_SOCKET_H */ diff --git a/lib/winsock.c b/lib/winsock.c --- a/lib/winsock.c +++ b/lib/winsock.c @@ -104,6 +104,7 @@ } } +#if GNULIB_SOCKET int rpl_socket (int domain, int type, int protocol) { @@ -119,8 +120,9 @@ else return SOCKET_TO_FD (fh); } +#endif - +#if GNULIB_CONNECT int rpl_connect (int fd, struct sockaddr *sockaddr, int len) { @@ -138,7 +140,9 @@ return r; } +#endif +#if GNULIB_ACCEPT int rpl_accept (int fd, struct sockaddr *addr, int *addrlen) { @@ -151,7 +155,9 @@ else return SOCKET_TO_FD (fh); } +#endif +#if GNULIB_BIND int rpl_bind (int fd, struct sockaddr *sockaddr, int len) { @@ -162,7 +168,9 @@ return r; } +#endif +#if GNULIB_GETPEERNAME int rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen) { @@ -173,7 +181,9 @@ return r; } +#endif +#if GNULIB_GETSOCKNAME int rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen) { @@ -184,7 +194,9 @@ return r; } +#endif +#if GNULIB_GETSOCKOPT int rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen) { @@ -195,7 +207,9 @@ return r; } +#endif +#if GNULIB_LISTEN int rpl_listen (int fd, int backlog) { @@ -206,6 +220,7 @@ return r; } +#endif int rpl_ioctl (int fd, unsigned long req, char *buf) @@ -218,6 +233,7 @@ return r; } +#if GNULIB_RECV int rpl_recv (int fd, void *buf, int len, int flags) { @@ -228,7 +244,9 @@ return r; } +#endif +#if GNULIB_SEND int rpl_send (int fd, const void *buf, int len, int flags) { @@ -239,7 +257,9 @@ return r; } +#endif +#if GNULIB_RECVFROM int rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from, int *fromlen) @@ -258,7 +278,9 @@ return r; } +#endif +#if GNULIB_SENDTO int rpl_sendto (int fd, const void *buf, int len, int flags, struct sockaddr *to, int tolen) @@ -270,7 +292,9 @@ return r; } +#endif +#if GNULIB_SETSOCKOPT int rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen) { @@ -281,3 +305,4 @@ return r; } +#endif diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 --- a/m4/sys_socket_h.m4 +++ b/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 7 +# sys_socket_h.m4 serial 8 dnl Copyright (C) 2005-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,6 +8,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], [ + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) AC_REQUIRE([AC_C_INLINE]) AC_CACHE_CHECK([whether is self-contained], @@ -88,3 +89,28 @@ fi AC_SUBST([HAVE_WINSOCK2_H]) ]) + +AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR([$1]) +]) + +AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], +[ + GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) + GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) + GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) + GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) + GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) + GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) + GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) + GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) + GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) + GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) + GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) + GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) + GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) +]) diff --git a/modules/accept b/modules/accept new file mode 100644 --- /dev/null +++ b/modules/accept @@ -0,0 +1,27 @@ +Description: +accept() function: accept a connection to a server socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([accept]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/bind b/modules/bind new file mode 100644 --- /dev/null +++ b/modules/bind @@ -0,0 +1,27 @@ +Description: +bind() function: bind a server socket to a port. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([bind]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/connect b/modules/connect new file mode 100644 --- /dev/null +++ b/modules/connect @@ -0,0 +1,27 @@ +Description: +connect() function: connect a client socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([connect]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/getpeername b/modules/getpeername new file mode 100644 --- /dev/null +++ b/modules/getpeername @@ -0,0 +1,28 @@ +Description: +getpeername() function: return information about the remote end of a connected +socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([getpeername]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/getsockname b/modules/getsockname new file mode 100644 --- /dev/null +++ b/modules/getsockname @@ -0,0 +1,28 @@ +Description: +getsockname() function: return information about the local end of a connected +socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([getsockname]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/getsockopt b/modules/getsockopt new file mode 100644 --- /dev/null +++ b/modules/getsockopt @@ -0,0 +1,27 @@ +Description: +getsockopt() function: retrieve optional settings on a socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([getsockopt]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/listen b/modules/listen new file mode 100644 --- /dev/null +++ b/modules/listen @@ -0,0 +1,27 @@ +Description: +listen() function: make a server socket ready for accepting connections. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([listen]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/poll-tests b/modules/poll-tests --- a/modules/poll-tests +++ b/modules/poll-tests @@ -11,6 +11,12 @@ errno perror sockets +socket +bind +setsockopt +listen +connect +accept configure.ac: AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h]) diff --git a/modules/recv b/modules/recv new file mode 100644 --- /dev/null +++ b/modules/recv @@ -0,0 +1,27 @@ +Description: +recv() function: receive (read) data from a connected socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([recv]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/recvfrom b/modules/recvfrom new file mode 100644 --- /dev/null +++ b/modules/recvfrom @@ -0,0 +1,27 @@ +Description: +recvfrom() function: receive (read) data from a potentially unconnected socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/select-tests b/modules/select-tests --- a/modules/select-tests +++ b/modules/select-tests @@ -10,6 +10,12 @@ errno perror sockets +socket +bind +setsockopt +listen +connect +accept configure.ac: diff --git a/modules/send b/modules/send new file mode 100644 --- /dev/null +++ b/modules/send @@ -0,0 +1,27 @@ +Description: +send() function: send (write) data to a connected socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([send]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/sendto b/modules/sendto new file mode 100644 --- /dev/null +++ b/modules/sendto @@ -0,0 +1,27 @@ +Description: +sendto() function: send (write) data to a potentially unconnected socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([sendto]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/setsockopt b/modules/setsockopt new file mode 100644 --- /dev/null +++ b/modules/setsockopt @@ -0,0 +1,27 @@ +Description: +setsockopt() function: specify optional settings on a socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/socket b/modules/socket new file mode 100644 --- /dev/null +++ b/modules/socket @@ -0,0 +1,27 @@ +Description: +socket() function: create a socket. + +Files: +lib/winsock.c + +Depends-on: +sys_socket +errno + +configure.ac: +AC_REQUIRE([gl_HEADER_SYS_SOCKET]) +if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([winsock]) +fi +gl_SYS_SOCKET_MODULE_INDICATOR([socket]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson diff --git a/modules/sys_socket b/modules/sys_socket --- a/modules/sys_socket +++ b/modules/sys_socket @@ -9,6 +9,7 @@ Depends-on: include_next +link-warning errno configure.ac: @@ -27,8 +28,22 @@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ + -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \ + -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \ + -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \ + -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \ + -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \ + -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \ + -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \ + -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \ + -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \ + -e 's|@''GNULIB_SEND''@|$()GNULIB_SEND|g' \ + -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \ + -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \ + -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/sys_socket.in.h; \ } > $@-t mv -f $@-t $@