From: "H. Peter Anvin" <hpa@zytor.com>
To: Ulrich Drepper <drepper@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: using kernel headers in libc headers
Date: Mon, 30 Nov 2009 09:01:02 -0800 [thread overview]
Message-ID: <4B13FA4E.1070901@zytor.com> (raw)
In-Reply-To: <a36005b50911300837s6fe4da73s973ccbe7401b9989@mail.gmail.com>
On 11/30/2009 08:37 AM, Ulrich Drepper wrote:
>
> It's likely in everybody's interest to get the kernel headers used.
> But for this mode #ifdefs are needed. I'm willing to do the work.
> Easy enough to do when I'm going through the headers one-by-one to
> enable them in glibc. But I don't want to start this work unless it's
> going to be accepted. The symbols would be something like
>
> __USE_MISC
>
> or
>
> __USE_GNU
>
> These are not macros which the user must define. The user sets macros
> like _GNU_SOURCE etc which then set all the appropriate __USE_* macros
> (see "info libc 'Feature Test Macros'" on machines with glibc
> installed). These names are somewhat glibc-specific but other libcs
> can (or already have) adapt them.
>
> So, what do you say?
Speaking for myself, I think #ifdefs utterly suck for this purpose.
First of all, because they tie back a glibc internal (the naming of
feature test macros) with the kernel headers. Second of all, because it
really makes it much harder to get things right. Third, because it
conflicts with the usage model in the kernel itself in a way that is
likely to cause breakage.
A better way is to factor out subsets; if <linux/sched.h> has too many
things, we can break out the POSIX parts into <linux/sched_posix.h> or
(certainly better if we have more than one of these)
<linux/sched/posix.h> which can also be included by <linux/sched.h>.
glibc can then choose to include or not include <linux/sched/posix.h>
depending on its configuration. The configuration macros remain a glibc
internal detail.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
next prev parent reply other threads:[~2009-11-30 17:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-30 16:37 using kernel headers in libc headers Ulrich Drepper
2009-11-30 17:01 ` H. Peter Anvin [this message]
2009-11-30 17:40 ` Chris Friesen
2009-11-30 17:43 ` Ulrich Drepper
2009-11-30 17:55 ` H. Peter Anvin
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=4B13FA4E.1070901@zytor.com \
--to=hpa@zytor.com \
--cc=drepper@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox