public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Header files and the kernel ABI
@ 2002-07-25  6:28 H. Peter Anvin
  2002-07-25  6:51 ` Andreas Dilger
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: H. Peter Anvin @ 2002-07-25  6:28 UTC (permalink / raw)
  To: linux-kernel

OK... I have had a thought grinding in my head for a while, and wanted
to throw it out for everyone to think about...

In the libc4/libc5 days, we attempted to use kernel headers in user
space.  This was a total mess, not the least because the kernel
headers tended to pull in a lot of other kernel headers, and the
datatypes were unsuitable to have spead all across userspace.

In glibc, the official rule is "don't use kernel headers."  This
causes problems, because certain aspects of the kernel ABI is only
available through the include files, and reproducing them by hand is
tedious and error-prone.

I'm in the process of writing a very tiny libc for initramfs, and will
likely have to deal with how to use the kernel ABI as well.

It seems to me that a reasonable solution for how to do this is not
for user space to use kernel headers, but for user space and the
kernel to share a set of common ABI description files[1].  These files
should be highly stylized, and only describe things visible to user
space.  Furthermore, if they introduce types, they should use the
already-established __kernel_ namespace, and of course __s* and __u*
could be used for specific types.

This means that we would be able to get rid of #if(n)def __KERNEL__ in
the main kernel header files, because there would be a separation by
file location -- something in the main kernel include files could
include the ABI description files, but the opposite should never be
true.

I would like to propose that these files be set up in the #include
namespace as <linux/abi/*>, with <linux/abi/arch/*> for any
architecture-specific support files (I do believe, however, that those
files should only be included by files in the linux/abi/ root.  This
probably would be a symlink to ../asm/abi in the kernel sources,
unless we change the kernel include layout.)  The linux/ namespace is
universally reserved for the kernel, and unlike <abi/*> I don't know
of any potential conflicts.  I was considered <kabi/*>, but it seems
cleaner to use existing namespace.

If people think this is an idea, I will try to set up the
infrastructure as part of my work on klibc, although I'm definitely
not going to be able to migrate every portion of every include file
that needs to be migrated all by myself.

Thoughts?

	-hpa



[1] I'm assuming here they are C include files, just because it's a
common language to everyone; however, it would be possible to create
an "ABI description language" which would compile to C headers as well
as perhaps other formats (assembly language support files?), ...)
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Header files and the kernel ABI
@ 2002-07-25 21:13 dank
  2002-07-26  2:37 ` jw schultz
  0 siblings, 1 reply; 18+ messages in thread
From: dank @ 2002-07-25 21:13 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

Oliver Xymoron <oxymoron@waste.org> wrote:
> 
> On Thu, 25 Jul 2002, Erik Andersen wrote:
> 
> > On Thu Jul 25, 2002 at 09:31:23AM -0700, H. Peter Anvin wrote:
> > > Oliver Xymoron wrote:
> > > >
> > > >Ideally, the ABI layer would be maintained and packaged separately from
> > > >both the kernel and glibc to avoid gratuitous changes from either side.
> > >
> > > I disagree.  The ABI is a product of the kernel and should be attached
> > > to it.  It is *not* a product of glibc -- glibc is a consumer of it, as
> > > are any other libcs.
> >
> > Agreed.  I maintain a libc and I certainly do not want to
> > have to maintain the kernel ABI of the day headers.  That
> > is clearly a job for the kernel.
> 
> The idea of maintaining them separately is that people won't be able to
> touch the ABI without explicitly going through a gatekeeper whose job is
> to minimize breakage. Linus usually catches ABI changes but not always.
> 
> I explicitly did _not_ suggest making it the job of libc maintainers. And
> the whole point of the exercise is to avoid ABI of the day anyway. The ABI
> should change less frequently than the kernel or libc. It's more analogous
> to something like modutils.

IMHO it should live with the kernel, at least for now.  
The ABI .h files can live in a walled-off area that stays as stable as possible.
Anyone building glibc should be able to grab the ABI .h files from a
recent linux kernel source tarball without much effort.  (Maybe we'd
add a 'install headers_install' make target to install the ABI .h files
to make it obvious how to get them.)

Imagine what would happen if the base ABI .h files were maintained 
as part of a future Linux Standard Base, with the kernel only maintaining
.h files for extensions to the base ABI.  You'd need to install the ABI .h 
files before you could build the kernel!  That might be the right way to
go, but let's not propose it until the ABI .h files exist and are useful.

- Dan

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2002-07-31 21:38 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-25  6:28 Header files and the kernel ABI H. Peter Anvin
2002-07-25  6:51 ` Andreas Dilger
2002-07-25  7:07   ` H. Peter Anvin
2002-07-25  7:32     ` Andreas Dilger
2002-07-25 16:29       ` Oliver Xymoron
2002-07-25 16:31         ` H. Peter Anvin
2002-07-25 18:19           ` Erik Andersen
2002-07-25 20:03             ` Oliver Xymoron
2002-07-27 11:29               ` Eric W. Biederman
2002-07-25 16:30       ` H. Peter Anvin
2002-07-25  8:00 ` DervishD
2002-07-25 13:08 ` Brad Hards
2002-07-25 16:09   ` DervishD
2002-07-25 16:17   ` H. Peter Anvin
2002-07-25 18:22     ` Erik Andersen
2002-07-31 21:37 ` Kernel ABI BoF at Linux-Kongress? [was: Header files and the kernel ABI] Brad Hards
  -- strict thread matches above, loose matches on Subject: below --
2002-07-25 21:13 Header files and the kernel ABI dank
2002-07-26  2:37 ` jw schultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox