From owner-freebsd-doc Mon Apr 2 4:12:27 2001 Delivered-To: freebsd-doc@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 72B5137B718; Mon, 2 Apr 2001 04:12:23 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id VAA09317; Mon, 2 Apr 2001 21:12:18 +1000 Date: Mon, 2 Apr 2001 21:11:06 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Dima Dorfman Cc: Robert Watson , freebsd-doc@FreeBSD.org, bde@FreeBSD.org Subject: Re: docs/26003: getgroups(2) lists NGROUPS_MAX but not syslimits.h In-Reply-To: <20010402021136.86E8B3E25@bazooka.unixfreak.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Sun, 1 Apr 2001, Dima Dorfman wrote: > Bruce Evans 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