Date: Mon, 2 Apr 2001 21:11:06 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Dima Dorfman <dima@unixfreak.org> Cc: Robert Watson <rwatson@FreeBSD.org>, freebsd-doc@FreeBSD.org, bde@FreeBSD.org Subject: Re: docs/26003: getgroups(2) lists NGROUPS_MAX but not syslimits.h Message-ID: <Pine.BSF.4.21.0104022039500.23949-100000@besplex.bde.org> In-Reply-To: <20010402021136.86E8B3E25@bazooka.unixfreak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 1 Apr 2001, Dima Dorfman wrote: > Bruce Evans <bde@zeta.org.au> writes: > > [POSIX.1-1996 specification of NGROUPS_MAX] > Based on this, attached is a proposed patch to getgroups.2. > Index: getgroups.2 > =================================================================== > RCS file: /st/src/FreeBSD/src/lib/libc/sys/getgroups.2,v > retrieving revision 1.7 > diff -u -r1.7 getgroups.2 > --- getgroups.2 2000/04/21 09:41:40 1.7 > +++ getgroups.2 2001/04/02 02:09:05 > @@ -57,10 +57,6 @@ > .Fn Getgroups > returns the actual number of groups returned in > .Fa gidset . > -No more than > -.Dv NGROUPS_MAX > -will ever > -be returned. > If > .Fa gidsetlen > is zero, > @@ -68,6 +64,19 @@ > returns the number of supplementary group IDs associated with > the calling process without modifying the array pointed to by > .Fa gidset . > +.Sh NOTES > +.St -p1003.1-96 > +defines an > +.Dv NGROUPS_MAX > +constant in > +.Aq Pa limits.h ; > +however, this value is > +.Qq Run-Time Increasable , > +and as such is effectively useless if the run-time value happens to be > +larger. > +Thus, dynamic allocation of > +.Fa gidset > +must always be used. This is too strict. Dynamic allocation or some sort of error recovery only must be used in very POSIX-portable software. An array of size NGROUPS_MAX is sufficient for [Free]BSD. We don't mention the POSIX requirements for most limits. We usually don't even use the POSIX names for the limits. E.g., PATH_MAX - 1 is usually spelled as 1023. I think we should distinguish the FreeBSD the behavior guaranteed by FreeBSD from the behavior guaranteed by POSIX very precisely if we document the POSIX behavior at all. I'm not sure which one should be documented in the main part of the man page. The single Unix Spec mostly documents only the POSIX behavior but FreeBSD man pages mostly only document only the FreeBSD behavior. Man pages that claim conformance to POSIX or STDC should be more careful about this (but getgroups.2 doesn't claim conformance :-). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0104022039500.23949-100000>