X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsys_socket.in.h;h=b60789f2a1dd0f7bb6cc321755712a4cafde7033;hb=69c1421980ea9c5e26f51079b467be67886bcead;hp=c4daaacf6f08d1430d3d649feb5bcac5581f35b7;hpb=ec5187624df26c48d82a6b62a875c2531ded1b6e;p=gnulib.git diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index c4daaacf6..b60789f2a 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -1,6 +1,6 @@ /* Provide a sys/socket header file for systems lacking it (read: MinGW) and for systems where it is incomplete. - Copyright (C) 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2011 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -26,6 +26,7 @@ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H /* Special invocation convention: @@ -49,6 +50,10 @@ . */ # include +/* On FreeBSD 6.4, defines some macros that assume that NULL + is defined. */ +# include + /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ @@ -66,10 +71,20 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ #if !@HAVE_SA_FAMILY_T@ +# if !GNULIB_defined_sa_family_t typedef unsigned short sa_family_t; +# define GNULIB_defined_sa_family_t 1 +# endif #endif -#if !@HAVE_STRUCT_SOCKADDR_STORAGE@ +#if @HAVE_STRUCT_SOCKADDR_STORAGE@ +/* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */ +# if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ +# ifndef ss_family +# define ss_family __ss_family +# endif +# endif +#else # include /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */ @@ -81,12 +96,16 @@ typedef unsigned short sa_family_t; : alignof (__ss_aligntype)) \ + sizeof (__ss_aligntype))) +# if !GNULIB_defined_struct_sockaddr_storage struct sockaddr_storage { sa_family_t ss_family; /* Address family, etc. */ __ss_aligntype __ss_align; /* Force desired alignment. */ char __ss_padding[_SS_PADSIZE]; }; +# define GNULIB_defined_struct_sockaddr_storage 1 +# endif + #endif #if @HAVE_SYS_SOCKET_H@ @@ -122,8 +141,8 @@ struct sockaddr_storage adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your code may not run on older Windows releases then. My Windows 2000 box was not able to run the code, for example. The situation is - slightly confusing because: - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp + slightly confusing because + suggests that getaddrinfo should be available on all Windows releases. */ @@ -151,7 +170,10 @@ struct sockaddr_storage # include # include +# if !GNULIB_defined_socklen_t typedef int socklen_t; +# define GNULIB_defined_socklen_t 1 +# endif # endif @@ -159,6 +181,8 @@ typedef int socklen_t; #if @HAVE_WINSOCK2_H@ +# if !GNULIB_defined_rpl_fd_isset + /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ static inline int @@ -175,6 +199,9 @@ rpl_fd_isset (SOCKET fd, fd_set * set) return 0; } +# define GNULIB_defined_rpl_fd_isset 1 +# endif + # undef FD_ISSET # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) @@ -237,8 +264,11 @@ _GL_FUNCDECL_RPL (connect, int, _GL_CXXALIAS_RPL (connect, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); # else -_GL_CXXALIAS_SYS (connect, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen)); +/* Need to cast, because on NonStop Kernel, the third parameter is + size_t addrlen. */ +_GL_CXXALIAS_SYS_CAST (connect, int, + (int fd, + const struct sockaddr *addr, socklen_t addrlen)); # endif _GL_CXXALIASWARN (connect); #elif @HAVE_WINSOCK2_H@ @@ -292,8 +322,11 @@ _GL_FUNCDECL_RPL (bind, int, _GL_CXXALIAS_RPL (bind, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); # else -_GL_CXXALIAS_SYS (bind, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen)); +/* Need to cast, because on NonStop Kernel, the third parameter is + size_t addrlen. */ +_GL_CXXALIAS_SYS_CAST (bind, int, + (int fd, + const struct sockaddr *addr, socklen_t addrlen)); # endif _GL_CXXALIASWARN (bind); #elif @HAVE_WINSOCK2_H@ @@ -514,9 +547,11 @@ _GL_CXXALIAS_RPL (sendto, ssize_t, (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)); # else -_GL_CXXALIAS_SYS (sendto, ssize_t, - (int fd, const void *buf, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen)); +/* Need to cast, because on NonStop Kernel, the sixth parameter is + size_t tolen. */ +_GL_CXXALIAS_SYS_CAST (sendto, ssize_t, + (int fd, const void *buf, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen)); # endif _GL_CXXALIASWARN (sendto); #elif @HAVE_WINSOCK2_H@ @@ -542,8 +577,11 @@ _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, const void * optval, socklen_t optlen)); # else -_GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname, - const void * optval, socklen_t optlen)); +/* Need to cast, because on NonStop Kernel, the fifth parameter is + size_t optlen. */ +_GL_CXXALIAS_SYS_CAST (setsockopt, int, + (int fd, int level, int optname, + const void * optval, socklen_t optlen)); # endif _GL_CXXALIASWARN (setsockopt); #elif @HAVE_WINSOCK2_H@