public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Erik Andersen <andersen@codepoet.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Rob Landley <rob@landley.net>,
	"Ihar 'Philips' Filipau" <filia@softhome.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Re: [PATCH] scsi.h uses "u8" which isn't defined.
Date: Tue, 19 Aug 2003 19:42:29 -0600	[thread overview]
Message-ID: <20030820014228.GA7105@codepoet.org> (raw)
In-Reply-To: <20030819172651.GA15781@gtf.org>

On Tue Aug 19, 2003 at 01:26:51PM -0400, Jeff Garzik wrote:
> > Or used directly by uclibc (and linux from scratch) to build the library 
> > against.
> 
> Yes, this is incorrect.
> 
> Kernel developers have been telling people for years, "do not directly
> include kernel headers."

<Kernel developer hat on>

Yes.  As a kernel developer I regularly tell people to make their
own private copy of the bits of kernel headers they need, to
prevent breakage when random bits in the kernel headers change.
I can't begin to count the number of applications I have fixed by
removing some kernel headers and then copying in the definition
of some random struct, adding a few ioctl defines, and then
changing everything to use types from stdint.h rather than the
kernel's internal typing.

I have also long maintained that this is incredibly stupid....
When I wrote the cdrom.h header file, for example, I wrote it to
define the interface which user space would use when talking to
the kernel.  I _designed_ that header file to be directly used by
user space, since that is the one and only spot that contains all
the relevant knowledge needed to interact with the kernel's cdrom
driver.  I mean, how else would user space know what to do?  It
is silly there needs to be N copies of the header file defining
this interface for N applications...  The fact the kernel has
mingled its internal interfaces and its external interfaces is a
serious and ugly blemish.


<uClibc maintainer hat on>

Not including kernel headers in user space is of course perfect
advice for your average piece of user space.  This is _not_
currently a reasonable request for a C library because the kernel
folk have not yet provided a reasonable alternative.  Looked at
glibc recently?  Just like uClibc, it determines the ABI of the
kernel against which it is compiled (in the case of glibc, via
the --with-headers configure option).  Distros such as RedHat and
Debian provide kernel-headers packages against which C libraries
are compiled.  Guess what those contain?  Kernel headers.  Kernel
headers which are used by user space because the kernel folk have
been too damn lazy to provide something better.

That said, for uClibc I have begun the process of eliminating the
dependence on kernel headers for random structs.  I now have arch
specific headers such as "kernel_stat.h", mainly since the kernel
headers are too inconsistant between architectures to be even
remotely usable.  But as others have noted, extracting and
sanitizing the entire kernel ABI is a huge amount of work and I
am nowhere close to done.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

  parent reply	other threads:[~2003-08-20  1:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <lRjc.6o4.3@gated-at.bofh.it>
     [not found] ` <lRjg.6o4.15@gated-at.bofh.it>
     [not found]   ` <lWLS.39x.5@gated-at.bofh.it>
     [not found]     ` <lWLZ.39x.29@gated-at.bofh.it>
2003-08-18 18:54       ` [PATCH] Re: [PATCH] scsi.h uses "u8" which isn't defined Ihar 'Philips' Filipau
2003-08-18 19:04         ` Jeff Garzik
2003-08-19 12:32           ` Rob Landley
2003-08-19 17:26             ` Jeff Garzik
2003-08-19 21:38               ` Will uclibc be supported in 2.6? (was Re: [PATCH] Re: [PATCH] scsi.h uses "u8" which isn't defined.) Rob Landley
2003-08-19 21:47                 ` Jeff Garzik
2003-08-20  1:42               ` Erik Andersen [this message]
2003-08-20 23:48             ` [PATCH] Re: [PATCH] scsi.h uses "u8" which isn't defined Jamie Lokier
2003-08-21  0:02               ` Jeff Garzik
2003-08-22  0:32                 ` Rob Landley
2003-08-22  0:50                   ` Chris Friesen
2003-08-22  1:58                     ` Rob Landley
2003-08-22  0:54                   ` Jeff Garzik
2003-08-18 20:40         ` Sam Ravnborg
2003-08-18 12:36 Andries.Brouwer
  -- strict thread matches above, loose matches on Subject: below --
2003-08-18 12:19 Andries.Brouwer
2003-08-18 12:24 ` Christoph Hellwig
2003-08-18 18:08   ` Sam Ravnborg
2003-08-18 18:14     ` Jeff Garzik
2003-08-18 15:21 ` Linus Torvalds
2003-08-18 15:32   ` Jeff Garzik
2003-08-18 16:13 ` Patrick Mansfield

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=20030820014228.GA7105@codepoet.org \
    --to=andersen@codepoet.org \
    --cc=filia@softhome.net \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob@landley.net \
    /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