Skip to content

Conversation

@sternenseemann
Copy link

This resolves an issue with glibc 2.31 I experienced where SO_REUSEPORT
would be missing because glibc only includes linux headers if __USE_MISC
is set which is caused by _DEFAULT_SOURCE in features.h.

To be precise test/main.c wouldn't compile on NixOS with glibc 2.31.

This resolves an issue with glibc 2.31 I experienced where SO_REUSEPORT
would be missing because glibc only includes linux headers if __USE_MISC
is set which is caused by _DEFAULT_SOURCE in features.h.
@sternenseemann
Copy link
Author

Adding -D_DEFAULT_SOURCE to CFLAGS also resolves the issue. Below is the offending bits/socket.h snippet for glibc 2.31 as found on my system. I'm actually not sure if this may be just a NixOS-specific oddity.

#ifdef __USE_MISC
# include <bits/types/time_t.h>
# include <asm/socket.h>
#else
# define SO_DEBUG 1
# include <bits/socket-constants.h>
#endif

asm/socket.h defines SO_REUSEPORT (it includes something from linux-headers), but bits/socket-constants.h does not.

@lindevel lindevel mentioned this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant