And this implements the modules for most of the functions from <sys/socket.h>.
The functions 'ioctl' and 'close' are not handled in this patch; they are a little more complicated. 2008-10-05 Bruno Haible <[EMAIL PROTECTED]> * 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. =============================== modules/accept ============================== 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/bind ================================ 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/connect ============================= 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/getpeername ========================= 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/getsockname ========================= 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/getsockopt ========================== 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/listen ============================== 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/recv ================================ 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/recvfrom ============================ 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/send ================================ 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/sendto ============================== 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/setsockopt ========================== 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson =============================== modules/socket ============================== 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: <sys/socket.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson ============================================================================= *** lib/sys_socket.in.h.orig 2008-10-06 01:55:27.000000000 +0200 --- lib/sys_socket.in.h 2008-10-06 01:50:55.000000000 +0200 *************** *** 98,103 **** --- 98,105 ---- # 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 <sys/types.h> *************** *** 105,113 **** typedef int socklen_t; ! # ifdef __cplusplus extern "C" { ! # endif /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ --- 107,119 ---- typedef int socklen_t; ! # endif ! ! # ifdef __cplusplus extern "C" { ! # endif ! ! # if @HAVE_WINSOCK2_H@ /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ *************** *** 128,189 **** # undef FD_ISSET # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) /* Wrap everything else to use libc file descriptors for sockets. */ # undef close # define close rpl_close # undef socket ! # define socket rpl_socket # undef connect ! # define connect rpl_connect # undef accept ! # define accept rpl_accept # undef bind ! # define bind rpl_bind # undef getpeername ! # define getpeername rpl_getpeername # undef getsockname ! # define getsockname rpl_getsockname # undef getsockopt ! # define getsockopt rpl_getsockopt # undef listen ! # define listen rpl_listen # undef ioctl # define ioctl rpl_ioctl # undef recv ! # define recv rpl_recv # undef send ! # define send rpl_send # undef recvfrom ! # define recvfrom rpl_recvfrom # undef sendto ! # define sendto rpl_sendto # undef setsockopt ! # define setsockopt rpl_setsockopt # undef select # define select select_used_without_including_sys_select_h ! 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 } ! # endif ! ! # endif /* HAVE_WINSOCK2_H */ #endif /* HAVE_SYS_SOCKET_H */ --- 134,384 ---- # 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 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(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(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(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(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(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(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 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 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 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 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(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 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 ! # ifdef __cplusplus } ! # endif #endif /* HAVE_SYS_SOCKET_H */ *** lib/winsock.c.orig 2008-10-06 01:55:27.000000000 +0200 --- lib/winsock.c 2008-10-06 01:50:55.000000000 +0200 *************** *** 104,109 **** --- 104,110 ---- } } + #if GNULIB_SOCKET int rpl_socket (int domain, int type, int protocol) { *************** *** 119,126 **** else return SOCKET_TO_FD (fh); } ! int rpl_connect (int fd, struct sockaddr *sockaddr, int len) { --- 120,128 ---- else return SOCKET_TO_FD (fh); } + #endif ! #if GNULIB_CONNECT int rpl_connect (int fd, struct sockaddr *sockaddr, int len) { *************** *** 138,144 **** --- 140,148 ---- return r; } + #endif + #if GNULIB_ACCEPT int rpl_accept (int fd, struct sockaddr *addr, int *addrlen) { *************** *** 151,157 **** --- 155,163 ---- else return SOCKET_TO_FD (fh); } + #endif + #if GNULIB_BIND int rpl_bind (int fd, struct sockaddr *sockaddr, int len) { *************** *** 162,168 **** --- 168,176 ---- return r; } + #endif + #if GNULIB_GETPEERNAME int rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen) { *************** *** 173,179 **** --- 181,189 ---- return r; } + #endif + #if GNULIB_GETSOCKNAME int rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen) { *************** *** 184,190 **** --- 194,202 ---- return r; } + #endif + #if GNULIB_GETSOCKOPT int rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen) { *************** *** 195,201 **** --- 207,215 ---- return r; } + #endif + #if GNULIB_LISTEN int rpl_listen (int fd, int backlog) { *************** *** 206,211 **** --- 220,226 ---- return r; } + #endif int rpl_ioctl (int fd, unsigned long req, char *buf) *************** *** 218,223 **** --- 233,239 ---- return r; } + #if GNULIB_RECV int rpl_recv (int fd, void *buf, int len, int flags) { *************** *** 228,234 **** --- 244,252 ---- return r; } + #endif + #if GNULIB_SEND int rpl_send (int fd, const void *buf, int len, int flags) { *************** *** 239,245 **** --- 257,265 ---- return r; } + #endif + #if GNULIB_RECVFROM int rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from, int *fromlen) *************** *** 258,264 **** --- 278,286 ---- return r; } + #endif + #if GNULIB_SENDTO int rpl_sendto (int fd, const void *buf, int len, int flags, struct sockaddr *to, int tolen) *************** *** 270,276 **** --- 292,300 ---- return r; } + #endif + #if GNULIB_SETSOCKOPT int rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen) { *************** *** 281,283 **** --- 305,308 ---- return r; } + #endif *** m4/sys_socket_h.m4.orig 2008-10-06 01:55:28.000000000 +0200 --- m4/sys_socket_h.m4 2008-10-06 01:50:55.000000000 +0200 *************** *** 1,4 **** ! # sys_socket_h.m4 serial 7 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, --- 1,4 ---- ! # 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,13 **** --- 8,14 ---- AC_DEFUN([gl_HEADER_SYS_SOCKET], [ + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) AC_REQUIRE([AC_C_INLINE]) AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], *************** *** 88,90 **** --- 89,116 ---- 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]) + ]) *** modules/sys_socket.orig 2008-10-06 01:55:28.000000000 +0200 --- modules/sys_socket 2008-10-06 01:55:24.000000000 +0200 *************** *** 9,14 **** --- 9,15 ---- Depends-on: include_next + link-warning errno configure.ac: *************** *** 27,34 **** --- 28,49 ---- -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; \ } > [EMAIL PROTECTED] mv -f [EMAIL PROTECTED] $@ *** doc/posix-functions/accept.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/accept.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/accept.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/accept.html} ! Gnulib module: accept Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/bind.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/bind.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/bind.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/bind.html} ! Gnulib module: bind Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/connect.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/connect.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/connect.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/connect.html} ! Gnulib module: connect Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/getpeername.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/getpeername.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/getpeername.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/getpeername.html} ! Gnulib module: getpeername Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/getsockname.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/getsockname.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/getsockname.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/getsockname.html} ! Gnulib module: getsockname Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/getsockopt.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/getsockopt.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/getsockopt.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/getsockopt.html} ! Gnulib module: getsockopt Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/listen.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/listen.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/listen.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/listen.html} ! Gnulib module: listen Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/recv.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/recv.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/recv.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/recv.html} ! Gnulib module: recv Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/recvfrom.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/recvfrom.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/recvfrom.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/recvfrom.html} ! Gnulib module: recvfrom Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/send.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/send.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/send.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/send.html} ! Gnulib module: send Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/sendto.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/sendto.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/sendto.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/sendto.html} ! Gnulib module: sendto Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/setsockopt.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/setsockopt.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/setsockopt.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/setsockopt.html} ! Gnulib module: setsockopt Portability problems fixed by Gnulib: @itemize *** doc/posix-functions/socket.texi.orig 2008-10-06 01:55:27.000000000 +0200 --- doc/posix-functions/socket.texi 2008-10-06 01:50:55.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/socket.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/socket.html} ! Gnulib module: socket Portability problems fixed by Gnulib: @itemize *** modules/poll-tests.orig 2008-10-06 01:55:28.000000000 +0200 --- modules/poll-tests 2008-10-06 01:50:55.000000000 +0200 *************** *** 11,16 **** --- 11,22 ---- errno perror sockets + socket + bind + setsockopt + listen + connect + accept configure.ac: AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h]) *** modules/select-tests.orig 2008-10-06 01:55:28.000000000 +0200 --- modules/select-tests 2008-10-06 01:50:55.000000000 +0200 *************** *** 10,15 **** --- 10,21 ---- errno perror sockets + socket + bind + setsockopt + listen + connect + accept configure.ac: