Joachim Schmitz wrote: > socklen_t is typedef'ed in <sys/socket.h> (and as an int) but, for some > strange and probably historical reason, not used anywhere, in particular > not in those socket funktions with use a size_t instead (which is > typedefe'ed to an unsigned integer)
OK, I wanted to know whether socklen_t comes from NSK or from gnulib. Since you say it comes from NSK, we cannot change it. > My 'fix' so far: > diff -u ./gllib/sys_socket.in.h.orig ./gllib/sys_socket.in.h > --- ./gllib/sys_socket.in.h.orig 2010-11-30 14:19:12.000000000 -0600 > +++ ./gllib/sys_socket.in.h 2010-12-23 04:43:53.000000000 -0600 > @@ -165,6 +165,10 @@ > > #endif > > +#ifdef __TANDEM > +#define socklen_t size_t > +#endif This is not good. Other libraries (in user programs) may use the socklen_t type in their external API. gnulib cannot simply change it. I'm committing a more relaxed handling of the declarations instead: 2010-12-24 Bruno Haible <br...@clisp.org> sys_socket: Hide mismatch of declarations on NonStop Kernel. * lib/sys_socket.in.h (connect, bind, sendto, setsockopt): Use _GL_CXXALIAS_SYS_CAST instead of _GL_CXXALIAS_SYS. Reported by Joachim Schmitz <j...@schmitz-digital.de>. --- lib/sys_socket.in.h.orig Fri Dec 24 17:13:49 2010 +++ lib/sys_socket.in.h Fri Dec 24 17:12:57 2010 @@ -245,8 +245,11 @@ _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@ @@ -300,8 +303,11 @@ _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@ @@ -522,9 +528,11 @@ (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@ @@ -550,8 +558,11 @@ _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@