lkml.org 
[lkml]   [2003]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Re: [PATCH] scsi.h uses "u8" which isn't defined.
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--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.237 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site