Skip to content

Commit

Permalink
Conditionally include linux/udp.h (#2894)
Browse files Browse the repository at this point in the history
### Motivation:

To enable access to `UDP_MAX_SEGMENTS` we switched from including
`netinet/udp.h` to including `linux/udp.h` however the latter isn't
available in MUSL.

### Modifications:

if `linux/udp.h` is available then import it in favor of
`netinet/udp.h`. If we fall back to the latter then `UDP_MAX_SEGMENTS`
won't be defined but that will be caught by the existing paths which
account for this case.

### Result:

NIO should be able to build against a static MUSL SDK again.
  • Loading branch information
rnro authored Sep 20, 2024
1 parent 1109474 commit f666505
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/CNIOLinux/include/CNIOLinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
#include <errno.h>
#include <pthread.h>
#include <netinet/ip.h>
#if __has_include(<linux/udp.h>)
#include <linux/udp.h>
#else
#include <netinet/udp.h>
#endif
#include <linux/vm_sockets.h>
#include <fcntl.h>
#include <fts.h>
Expand Down

0 comments on commit f666505

Please sign in to comment.