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

Bug#658460: SOCK_NONBLOCK doubly defined in system headers on Alpha



Package: linux-libc-dev
Version: 3.2.1-1
Severity: normal
User: debian-alpha@lists.debian.org
Usertags: alpha
X-Debbugs-CC: debian-alpha@lists.debian.org

The simple test program:

#include <linux/net.h>
#include <sys/socket.h>

fails to compile on the Alpha arch with the following:

$ gcc -c test.c
In file included from /usr/include/alpha-linux-gnu/sys/socket.h:40:0,
                 from test.c:2:
/usr/include/alpha-linux-gnu/bits/socket.h:68:3: error: expected
identifier before numeric constant

It is because <linux/net.h> eventually includes
/usr/include/alpha-linux-gnu/asm/socket.h which ends with the following:

/* O_NONBLOCK clashes with the bits used for socket types.  Therefore we
 * have to define SOCK_NONBLOCK to a different value here.
 */
#define SOCK_NONBLOCK   0x40000000

Then <sys/socket.h> includes /usr/include/alpha-linux-gnu/bits/socket.h
(from libc6.1-dev) which has the following:

enum __socket_type
{
    ...snip...
  SOCK_NONBLOCK = 0x40000000    /* Atomically mark descriptor(s) as
                                   non-blocking.  */
}

which with the above macro definition becomes

0x40000000 = 0x40000000

inside the enumeration, and the compiler understandingly barfs.  Indeed
this is the cause of the FTBFS of the package audit which compiles on
all other arches without a problem but fails on Alpha due to the double
definition of SOCK_NONBLOCK.

I suspect that SOCK_NONBLOCK should not be defined in <asm/socket.h> in
linux-libc-dev.

Cheers
Michael.



Reply to: