mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: kernel header compatibility
Date: Tue, 8 Nov 2016 20:39:30 -0500	[thread overview]
Message-ID: <20161109013930.GI1555@brightrain.aerifal.cx> (raw)
In-Reply-To: <20161109011145.GA31880@nyan>

On Tue, Nov 08, 2016 at 08:11:45PM -0500, Felix Janda wrote:
> The recent commit 04983f2272382af92eb8f8838964ff944fbb8258 (make
> netinet/in.h suppress clashing definitions from kernel headers)
> intends to address some of the conflicts between the kernel and musl
> libc headers. Namely it tries to allow the inclusion of kernel headers
> after libc header by defining __UAP_DEF_* macros. However this doesn't
> work because the relevant linux headers include <linux/libc-compat.h>,
> which unconditionally redefines the constants. For example

Oh, how awful. I missed the whole bogus #else part after the #if
defined(__GLIBC__) block.
> 
> #include <netinet/in.h>
> #include <linux/in6.h>
> 
> leads to
> 
> #define __UAPI_DEF_IN_ADDR 0 // from <netinet/in.h>
> #define __UAPI_DEF_IN_ADDR 1 // from <linux/libc-compat.h>

Conflicting defines should be an error already.

> So we still get two conflicting definitions of struct in6_addr.
> 
> 
> By adding the hack "#define _LIBC_COMPAT_H" to <netinet/in.h>, this
> particular example compiles.
> 
> 
> Maybe the kernel people can be convinced to add #ifdef guards around
> all of the (non glibc) __UAPI_* definitions in <linux/libc-compat.h>.

I think they should, but I don't mind just suppressing the whole
header by defining _UAPI_LIBC_COMPAT_H if that works for all kernel
versions. It seems to; see:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/libc-compat.h?id=cfd280c91253cc28e4919e349fa7a813b63e71e8

where the file was introduced.

Rich


  reply	other threads:[~2016-11-09  1:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09  1:11 Felix Janda
2016-11-09  1:39 ` Rich Felker [this message]
2016-11-09  1:54   ` Felix Janda
2016-11-09  2:14     ` Rich Felker
2016-11-10  1:28       ` Felix Janda
2016-11-10  4:39         ` Rich Felker
2016-11-10  9:21           ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161109013930.GI1555@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).