Re: uid_t and gid_t vs. __kernel_uid_t and __kernel_gid_t

From: Chris Wing (wingc@engin.umich.edu)
Date: Mon May 14 2001 - 14:27:26 EST


Vassilii:

__kernel_uid_t is my fault. The names are confusing, but uid_t and gid_t
are NOT supposed to be different in kernel and user space.

They used to differ, and the junk in /include/linux/highuid.h is there to
handle all old programs which used the smaller (16-bit) uid_t.

Kernel code should always use uid_t as a type, except when copying data
between user and kernel space. In that case, just make sure that whatever
data structure you use is big enough to contain a Linux uid_t. (as of 2.4,
Linux uses 32-bit uid_t on all platforms) All new interfaces to user space
should use 32-bit uids, i.e. type unsigned int.

Don't use __kernel_uid_t at all in new code. The name is basically there
only because the older libc5 C library included the kernel headers and we
have to preserve it so that programs still compile on these old systems.

if you look inside /include/linux/types.h, this is made explicit:

#ifdef __KERNEL__
typedef __kernel_uid32_t uid_t;
typedef __kernel_gid32_t gid_t;
...
...

Thanks,

Chris Wing
wingc@engin.umich.edu

-
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/



This archive was generated by hypermail 2b29 : Tue May 15 2001 - 21:00:36 EST