[lkml]   [2004]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] Splitting kernel headers and deprecating __KERNEL__
Linus Torvalds wrote:
> Ok, this discussion has gone on for too long anyway, but let's make it
> easier for everybody. The kernel uses u8/u16/u32 because:
> - the kernel should not depend on, or pollute user-space naming.
> YOU MUST NOT USE "uint32_t" when that may not be defined, and
> user-space rules for when it is defined are arcane and totally
> arbitrary.

Hmm, so you're predicting problems if user space includes something
that uses uint32_t ? Wouldn't either of these work (descriptive file
names for clarity):

1) include/linux-user/foo.h:
#include <stdint.h>
#include <linux-kernel-and-user-common/foo.h>

#include <linux/stdint.h>
#include <linux-kernel-and-user-common/foo.h>

(And document that anything under linux-user may pull in a
certain set of standard headers, such as stdint.h, maybe
sys/types.h, etc.)

2) include/linux-user/foo.h:
#ifndef __KERNEL__
#include <stdint.h>
#include <linux/stdint.h> /* if we want this */
foo stuff (or some include)

Idem. (Sort of the opposite of what we have today.)

3) just require that some stdint.h has been included before
including linux-user/foo.h

For user space that absolutely insists on doing its own uint32_t,
a refined variant of case 3 (i.e. detailing of what exactly is
expected to be defined) or, in case 1, direct use of
linux-kernel-and-user-common/foo.h along with the definition from
case 3 should work.

There are other cases where a header file may pull in other
definitions, e.g. for fcntl.h, POSIX decrees

| Inclusion of the <fcntl.h> header may also make visible all
| symbols from <sys/stat.h> and <unistd.h>.

So the semantics of for cases 1 and 2 would be consistent with
current POSIX practice.

What am I missing ?

- Werner

/ Werner Almesberger, Buenos Aires, Argentina /
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:08    [W:0.257 / U:1.736 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site