[PLUG] unsigned short UIDs?

Benjamin A. Kuperman kuperman@cs.purdue.edu
Tue, 17 Nov 1998 14:13:21 -0500


Quoting williamj@cs.purdue.edu (williamj@cs.purdue.edu):
> > I understand that unsigned shorts are used for UIDs in Linux.  Please
> > let me know if you know of a Linux (not FreeBSD or Solaris) or any
> > work going on to use ints or unsigned ints for UIDS.  I'll summarize to
> > the list.
> 
> This is done in the kernel and shouldnt depend on a certain Linux
> distribution.  Plus, I doubt there will be much of a need to support

Properly written programs will use the type 'uid_t' for references to
the actual user id.  In redhat 5.1 this type is defined as:

/usr/include/asm/posix_types.h:typedef unsigned short __kernel_uid_t;
/usr/include/linux/types.h:typedef __kernel_uid_t               uid_t; 

and

/usr/include/gnu/types.h:typedef unsigned int __u_int;
/usr/include/gnu/types.h:typedef __u_int __uid_t;
/usr/include/sys/types.h:typedef __uid_t uid_t;

So in this version they use unsigned short at the kernel, and unsigned
int for the gnu based programs.  Now for Mark (gentleman double
indented above) you can see that most of the linux software already
uses unsigned int as the uid type.  (Since most programs will use
"sys/types.h" instead of "linux/types.h")  It seems that with a single
change in "asm/posix_types.h" the kernel can be built to fully support
unsigned int as the uid type.  Of course, you will need to recompile
any programs that use "linux/types.h" or risk overflowing the value.
However, properly written programs should not need additional changes.
My suspicion is that many programmers assumed that uid_t was an
unsigned short, and hence making this change will likely break a few
programs.

-ben.

--
This message is from the Purdue Linux Users' Group (PLUG) mailing list.
Send mail server commands to <plug-request@csociety.purdue.edu>.