From owner-freebsd-doc Sun Apr 1 3:33:33 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 C7AB237B719; Sun, 1 Apr 2001 03:33:27 -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 UAA26259; Sun, 1 Apr 2001 20:33:22 +1000 Date: Sun, 1 Apr 2001 20:32:11 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Robert Watson Cc: dd@FreeBSD.org, freebsd-doc@FreeBSD.org, bde@FreeBSD.org Subject: Re: docs/26003: getgroups(2) lists NGROUPS_MAX but not syslimits.h In-Reply-To: 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 Sat, 31 Mar 2001, Robert Watson wrote: > Dunno -- I guess this leads to a number of questions of specification-land > -- is NGROUPS_MAX supposed to be exposed to the application, if so, how > should the application go about including things to get the value, etc. > Bruce might have a good answer, if not a correct one, so I've CC'd him > :-). In POSIX.1-1996: 1) NGROUPS_MAX is defined in . ( is BSD implementation detail, so it shouldn't be documented.) 2) NGROUPS_MAX is a "Run-Time Increasable Value". This means that applications may find that the actual maximum number of groups is larger than their compile time value of NGROUPS_MAX. The run time maximum is given by sysconf(_SC_NGROUPS_MAX). 3) Unlike some other POSIX limits, NGROUPS_MAX must be defined at compile time, although its value is almost useless if its run time value is larger. A footnote says that future revisions of POSIX.1 are expected to permit omitting the definition of NGROUPS_MAX from to indicate that its value is variable. The easiest way to use most of the POSIX limits is to never use them. For NGROUPS_MAX, strictly conforming POSIX programs don't even have the option of using an ifdef tangle to optimize the case where the compile time limit applies, since it is impossible to know at compile time whether it applies -- dynamic allocation must always be used. NGROUPS_MAX is useful at most as a hint. In FreeBSD, NGROUPS_MAX doesn't actually vary at runtime (unless someone compiles the kernel with a new value). getgroups.2 reflects this by mentioning NGROUPS_MAX. POSIX only says that EINVAL is returned when the array is too small to hold all the groups. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message