Subject: Re: Defining a maximum value for uid's.
To: None <jtc@NetBSD.ORG>
From: Mike Long <mikel@shore.net>
List: tech-userlevel
Date: 05/20/1997 11:28:22
>Date: Mon, 19 May 1997 10:37:23 -0700
>From: "J.T. Conklin" <jtc@NetBSD.ORG>
[lukem wrote:]
>> To do this, I've been converting the use of atoi() to strtoul(), and
>> checking appropriate values to ensure that the parsed field was just a
>> number.
>>
>> However, on the alpha, the return value of strtoul() is a unsigned 64
>> bit long, which may exceed the size of uid_t (unsigned 32 bit int).
>>
>> So, I would like to create the following defines in <limits.h> or
>> <machine/limits.h>, and check against them in the relevant areas:
>> #define UID_MAX 4294967294 /* 2^32 - 2 */
>> #define GID_MAX 4294967294
>
>Hmm, if my rusty memory cells aren't failing me, I think that XPG4.2
>may have specified macros for this purpose. Unfortunately, I don't
>have the documents with me; and the MAXUID I found by grep'ing thru
>Solaris 2.5 headers doesn't ring a bell.
>
>If there is an established standard (or even de facto convention) for
>uid/gid maximum manifest constants, we should use those names.
>Otherwise, UID_MAX and GID_MAX are fine with me.
I took a look at some of the systems we use at ADI. I found that all
of them have a MAXUID definition in <sys/param.h>, and all but one
(SunOS 4) have an identical UID_MAX definition in <limits.h>. The
values used were:
OS MAXUID UID_MAX
------------------------------------------------
SunOS 4.1.4 0xfffd (none)
SunOS 5.5.1 2147483647 2147483647
Irix 5.2 60002 60002
HP-UX 9.07 60000 MAXUID
HP-UX B.10.20 0x7fffffff MAXUID
I was unable to find any evidence of anything like GID_MAX; I think
all of these systems may just use UID_MAX or MAXUID instead.
--
Mike Long <mikel@shore.net> http://www.shore.net/~mikel
"Every normal man must be tempted at times to spit on his hands,
hoist the black flag, and begin slitting throats." -- H.L. Mencken