Re: [RFC] Splitting kernel headers and deprecating __KERNEL__

H. Peter Anvin
2004-12-01T05:51:13Z

Followup to: <Pine.LNX.4.58.0411301243000.22796@ppc970.osdl.org>
By author: Linus Torvalds <torvalds@osdl.org>
In newsgroup: linux.dev.kernel
>
> But claiming that __KERNEL__ doesn't work is clearly a bunch of crapola.
> As is the notion that you can somehow do it all. We do it in small pieces.
>

IMNSHO, based on my experience with klibc, the problem is not #ifdef
__KERNEL__, the *specific* problems are:

- The kernel exporting libc4/5 internals, which are neither what the
kernel nor any kind of modern userspace wants. This should be
possible to get rid of easily enough.

- The kernel exporting things into the userspace namespace. The
kernel's definition of "struct stat" isn't usable -- the one that is
useful is called "struct stat64" on most, but not all,
architectures, but because it's a structure tag it can't be pulled
from the exported kernel ABI in such a way that what userspace calls
"struct stat" is what the kernel currently calls "struct stat64" if
that exists.

This one is a bit uglier, since it probably needs something like:

#ifdef __KERNEL__
#define __kabi_stat64 stat64
#endif

struct __kabi_stat64 { ... };

-hpa