sysdeps/unix/sysv/linux/bits/socket.h defines struct ucred behind #ifdef __USE_GNU but ucred is not a GNU-specific extension. This breaks compiling a number of sources if -D_GNU_SOURCE is not specified in CFLAGS. This modification has been introduced in revision 1.61 of MAIN trunk (tagged as glibc-2_8-branch)
This is a POSIX header and ucred is not in the POSIX namespace. Fix you app to pass the correct flags.
The ifdef is clearly wrong: /* Socket level message types. This must match the definitions in <linux/socket.h>. */ enum { SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ #define SCM_RIGHTS SCM_RIGHTS #ifdef __USE_BSD , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif }; #ifdef __USE_GNU /* User visible structure for SCM_CREDENTIALS message */ struct ucred { pid_t pid; /* PID of sending process. */ uid_t uid; /* UID of sending process. */ gid_t gid; /* GID of sending process. */ }; #endif The comment says the struct is used for the SCM_CREDENTIALS message. Therefore it should at least be #ifdef __USE_BSD or #ifdef SCM_CREDENTIALS, not #ifdef __USE_GNU. Since the structure is also used by getsockopt(...SO_PEERCRED) it should probably be #if defined(SO_PEERCRED) || defined(SCM_CREDENTIALS) The comment should probably also be extended to indicate that it's also used for the Linux-specific SO_PEERCRED sockopt.
I've changed the header to make SCM_CREDENTIALS only available wen __USE_GNU is defined. BSD doesn't use this symbol/