[libc-commits] [libc] [libc] Add struct ipv6_mreq and IPv6 socket options (PR #206448)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Mon Jun 29 06:52:05 PDT 2026
================
@@ -19,14 +19,6 @@
#define IPPROTO_IPV6 41
#define IPPROTO_RAW 255
-#define IPV6_UNICAST_HOPS 16
----------------
labath wrote:
I have *considered* it. It's tricky because linux/in6.h ends up defining a lot of things including may types like struct sockaddr_in6 et al.
The header contain some logic (see linux/libc-compat.h) to avoid collisions with a libc (with different behavior depending on which version was included first), but it only contains code for glibc, so there are only two ways to make that work:
- simulate glibc closely to match the compatibility protocol (this includes `#defining __GLIBC__`)
- remove all our definitions of the entities defined by the kernel (making it behave always like it was included first)
Neither option sounds particularly appealing. In the first one, we constrain ourselves to a very particular layout. In the second one, we lose our granular dependencies, and control over how we define types (for instance, we could not add `__attribute__((may_alias))` to the sockaddr types.
As for OS-specificity, yes, I fully expect different OSes (hopefully not different arches) to have different values for these. This patch doesn't change that in the sense that in the sense that the original header was also defining the constants unconditionally. It's true that it would be easier to fix that in the header (`ifdef __linux__`), but given our desire to put things in the yaml file, I assumed that we'd eventually teach hdrgen to generate per-os constants (branching off of `standards: linux ?). I can easily revert this part if you think that's be better.
https://github.com/llvm/llvm-project/pull/206448
More information about the libc-commits
mailing list