![]() |
|
Message-ID: <20251014165307.GO1827@brightrain.aerifal.cx> Date: Tue, 14 Oct 2025 12:53:08 -0400 From: Rich Felker <dalias@...c.org> To: "Chen, Qi" <Qi.Chen@...driver.com> Cc: "musl@...ts.openwall.com" <musl@...ts.openwall.com> Subject: Re: [PATCH 2/2] include/netinet/if_ether.h: guard ethhdr definition to better work with other header files On Thu, Oct 09, 2025 at 02:53:13AM +0000, Chen, Qi wrote: > Hi Rich, > > The problem is about the re-definition of 'struct ethhdr'. > > For example, a header also defines 'struct ethhdr' and > __UAPI_DEF_ETHHDR, and it's included *before* our > <netinet/if_ether.h>, then the unconditional definition of 'struct > ethhdr' in this header will be treated as an error. > > Some background info: > I was making systemd to compile with musl. I got this re-definition > error. I checked the headers and thought that for different headers > to work together, the definition of this 'struct ethhdr' needs to be > guarded by the same macro. It's intentional that we don't support getting definitions for the libc types from kernel headers. They may have subtle mismatches that could break things. For example some types in the kernel are known-wrong, like struct msghdr, and others have members that are the same size/representation but different type (like long long vs int64_t). For the most part conflicting kernel headers shouldn't be used in userspace. In cases where they should/need to be used, they should be used either in separate translation units or included after the libc headers. This is documented in the original commit which added the __UAPI macros, 04983f2272382af92eb8f8838964ff944fbb8258. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.