Re: [RFC] Splitting kernel headers and deprecating __KERNEL__

From: Krzysztof Halasa
Date: Tue Dec 14 2004 - 21:02:25 EST


Werner Almesberger <wa@xxxxxxxxxxxxxxx> writes:

> A first step towards enabling converence would be to _guarantee_
> that glibc types are _identical_ to the kernel types, e.g.
>
> /usr/include/stdint.h:
> #include <linux-user/types.h> /* only __u32 and such */
>
> typedef __u32 uint32_t;
> ...
>
> (If they just "happen to be the same", people may still not trust
> this, and will feel justified inventing their own schemes. And as
> ugly as uint32_t may look, it's still infinitely better than code
> where each library contributes its own set of sized integers ...)

Not sure about this. I think such types should be defined by the
kernel, for it's use only. The libc (and any other userspace
software) may probably use them (if they have to), but must not
(re)define them.
The userspace should probably best use standard types. This is
userspace to know if their uint32_t has standard meaning equivalent
to __u32 or if it's actually a function name.


So i think we should have:

kernel-include/headers.h:
#define __u32 ...

struct some_structure {
__u32 var;
}str1;


and then userspace.c (libc et al) should:

#include linux/headers.h

str1 v;
uint32_t variable = v.var;

or maybe with some type conversion:

long long v2 = v.var;
unsigned char v3 = v.var;
--
Krzysztof Halasa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/