the uid type (uid_t): signed or unsigned?

Scott Guthridge aho at mentor.cc.purdue.edu
Wed Jun 7 20:23:28 AEST 1989


If you look through the include files for Sunos 4.0, you find that the
signedness of variables holding "uid"s is very inconsistent.  For example,
the uid_t type in sys/types.h is an unsigned short as are most of the uids
used for the file system.  The uids for credentials, however, are signed
short.  Similarly, there are some random inconsistencies in these types
under Ultrix 2.2 and Dynix 3.0.

4.3BSD did better by using their (unsigned short) uid_t typedef very
consistently within the kernel (also, the Mt. Xinu distribution with NFS).
Still, none of the above systems use uid_t in the password structure for
the getpwent routines -- they use signed int.

I'm bringing this up mostly because I'm working on a central accounting
system at our site and, because of the inconsistencies in the types of
uids, I'm finding it difficult to administer the "nobody" login as uid -2.
On about half of our hosts, it may appear as 65534.  I would like to
change it to a small positive number on our machines (making the
appropriate changes to the kernel defines for NFS), and I want to know
what it might break.

I did notice the reference to "-2" in the audit stuff on our Suns.  How
many other references to -2 are there?  Is there anything, in general,
significant about negative uids?

Scott Guthridge					aho at mentor.cc.purdue.edu
Purdue University Computing Center



More information about the Comp.sys.sun mailing list