bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accept4: depend on socklen


From: Bruno Haible
Subject: Re: accept4: depend on socklen
Date: Sat, 28 Aug 2010 10:23:23 +0200
User-agent: KMail/1.9.9

Hi Ralf,

> I needed this on some system but forgot which.

AFAICT, the systems which lack socklen_t are:
HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS.

>     accept4: depend on socklen

This patch is incomplete, because according to POSIX, <sys/socket.h> ought
to provide socklen_t, even if the user does not use any functions from this
header file. Likewise for <netdb.h>.

>     * modules/accept4: Reorder dependencies.  Add socklen.
>  Depends-on:
> -sys_socket
>  accept
>  fcntl-h
>  binary-io
>  extensions
> +socklen
> +sys_socket

sys_socket is at the beginning because it's the most important dependency
for this module, namely the module which provides the header file. Keep
most important things first, please.

I'm applying this patch instead. Can you report success or failure when
you had a chance to test it on one of the platforms listed above, please?


2010-08-28  Bruno Haible  <address@hidden>

        sys_socket, netdb: Ensure socklen_t gets defined.
        * modules/sys_socket (Depends-on): Add socklen.
        * modules/netdb (Depends-on): Likewise.
        * modules/getaddrinfo (Depends-on): Remove socklen.
        * modules/getsockopt (Depends-on): Likewise.
        * modules/setsockopt (Depends-on): Likewise.
        * tests/test-sys_socket.c: Check that socklen_t is defined.
        * tests/test-netdb.c: Likewise.
        * m4/socklen.m4: Update comments.
        Reported by Ralf Wildenhues <address@hidden>.

--- modules/sys_socket.orig     Sat Aug 28 10:12:36 2010
+++ modules/sys_socket  Sat Aug 28 09:22:10 2010
@@ -12,6 +12,7 @@
 c++defs
 errno
 include_next
+socklen
 warn-on-use
 
 configure.ac:
--- modules/netdb.orig  Sat Aug 28 10:12:36 2010
+++ modules/netdb       Sat Aug 28 09:21:56 2010
@@ -10,6 +10,7 @@
 arg-nonnull
 warn-on-use
 sys_socket
+socklen
 
 configure.ac:
 gl_HEADER_NETDB
--- modules/getaddrinfo.orig    Sat Aug 28 10:12:35 2010
+++ modules/getaddrinfo Sat Aug 28 09:21:08 2010
@@ -11,7 +11,6 @@
 gettext-h
 inet_ntop
 snprintf
-socklen
 stdbool
 sys_socket
 netdb
--- modules/getsockopt.orig     Sat Aug 28 10:12:35 2010
+++ modules/getsockopt  Sat Aug 28 09:21:08 2010
@@ -8,7 +8,6 @@
 Depends-on:
 sys_socket
 sys_time
-socklen
 errno
 
 configure.ac:
--- modules/setsockopt.orig     Sat Aug 28 10:12:36 2010
+++ modules/setsockopt  Sat Aug 28 09:21:07 2010
@@ -8,7 +8,6 @@
 Depends-on:
 sys_socket
 sys_time
-socklen
 errno
 
 configure.ac:
--- tests/test-sys_socket.c.orig        Sat Aug 28 10:12:36 2010
+++ tests/test-sys_socket.c     Sat Aug 28 09:25:54 2010
@@ -1,5 +1,5 @@
 /* Test of <sys/socket.h> substitute.
-   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -27,6 +27,9 @@
 int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
 #endif
 
+/* Check that the 'socklen_t' type is defined.  */
+socklen_t t1;
+
 int
 main (void)
 {
--- tests/test-netdb.c.orig     Sat Aug 28 10:12:36 2010
+++ tests/test-netdb.c  Sat Aug 28 09:25:26 2010
@@ -1,5 +1,5 @@
 /* Test of <netdb.h> substitute.
-   Copyright (C) 2007-2010 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -22,6 +22,9 @@
 /* Check that the 'struct hostent' type is defined.  */
 struct hostent t1;
 
+/* Check that the 'socklen_t' type is defined.  */
+socklen_t t2;
+
 int
 main (void)
 {
--- m4/socklen.m4.orig  Sat Aug 28 10:12:35 2010
+++ m4/socklen.m4       Sat Aug 28 10:11:59 2010
@@ -1,4 +1,4 @@
-# socklen.m4 serial 7
+# socklen.m4 serial 8
 dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 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,8 +8,9 @@
 
 dnl Check for socklen_t: historically on BSD it is an int, and in
 dnl POSIX 1g it is a type of its own, but some platforms use different
-dnl types for the argument to getsockopt, getpeername, etc.  So we
-dnl have to test to find something that will work.
+dnl types for the argument to getsockopt, getpeername, etc.:
+dnl HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS.
+dnl So we have to test to find something that will work.
 
 dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
 dnl it there first.  That file is included by gnulib's sys_socket.in.h, which



reply via email to

[Prev in Thread] Current Thread [Next in Thread]