docs/26003: getgroups(2) lists NGROUPS_MAX but not syslimits.h

Garrett Wollman wollman at csail.mit.edu
Sun Jan 27 10:20:03 PST 2008


The following reply was made to PR docs/26003; it has been noted by GNATS.

From: Garrett Wollman <wollman at csail.mit.edu>
To: freebsd-gnats-submit at freebsd.org
Cc:  
Subject: Re: docs/26003: getgroups(2) lists NGROUPS_MAX but not syslimits.h
Date: Sun, 27 Jan 2008 12:58:03 -0500

 <<On Sun, 27 Jan 2008 16:00:04 GMT, Bruce Evans <brde at optusnet.com.au> said:
 
 >  one (to be unportable by hard-coding NGROUPS_MAX).  The includes are
 >  already sufficient for using {NGROUPS_MAX} in its portable form
 >  sysconf(_SC_NGROUPS_MAX), except you will also need malloc().  <stdlib.h>
 >  for using malloc() is another include that doesn't belong in the
 >  synopsis.
 
 What Bruce said.  It would be better for constants such as this to be
 left completely undefined (at least when not compiling the kernel) --
 although there is the inevitable tension between handling these limits
 correctly and handling broken applications that do things like
 
 	#ifndef NGROUPS_MAX
 	#define NGROUPS_MAX 8
 	#endif
 
 Those applications, at least, are clearly wrong, so my vote would be
 on the side of breaking the applications and doing the Right Thing by
 not defining NGROUPS_MAX.
 
 -GAWollman


More information about the freebsd-standards mailing list