From owner-freebsd-doc Thu Mar 22 9:40:18 2001 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 85E5337B722 for ; Thu, 22 Mar 2001 09:40:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2MHe1883897; Thu, 22 Mar 2001 09:40:01 -0800 (PST) (envelope-from gnats) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 969BA37B71E for ; Thu, 22 Mar 2001 09:34:12 -0800 (PST) (envelope-from robert@fledge.watson.org) Received: (from robert@localhost) by fledge.watson.org (8.11.1/8.11.1) id f2MHYCH12034; Thu, 22 Mar 2001 12:34:12 -0500 (EST) (envelope-from robert) Message-Id: <200103221734.f2MHYCH12034@fledge.watson.org> Date: Thu, 22 Mar 2001 12:34:12 -0500 (EST) From: rwatson@freebsd.org Reply-To: rwatson@freebsd.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: docs/26003: getgroups(2) lists NGROUPS_MAX but not syslimits.h Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 26003 >Category: docs >Synopsis: getgroups(2) lists NGROUPS_MAX but not syslimits.h >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Thu Mar 22 09:40:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Robert Watson >Release: FreeBSD 4.2-STABLE i386 >Organization: FreeBSD Project >Environment: FreeBSD fledge.watson.org 4.2-STABLE FreeBSD 4.2-STABLE #0: Wed Jan 31 17:29:21 EST 2001 root@fledge.watson.org:/usr/obj/data/fbsd-stable/src/sys/FLEDGE i386 FreeBSD sproing.gw.tislabs.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Tue Feb 27 15:45:03 EST 2001 rwatson@sproing.gw.tislabs.com:/usr/obj/usr/src/sys/GENERIC i386 >Description: man getgroups notes that no more than NGROUPS_MAX will be returned by the function, suggesting that this is an upper bound on the gidset array that can be used by an application. However, the man page lists only sys/types.h and unistd.h as required include files, and NGROUPS_MAX is not defined in either of those. To get NGROUPS_MAX, it is necessary to include sys/syslimits.h. SYNOPSIS #include #include int getgroups(int gidsetlen, gid_t *gidset) ... number of entries that may be placed in gidset. Getgroups() returns the actual number of groups returned in gidset. No more than NGROUPS_MAX will ever be returned. If gidsetlen is zero, getgroups() returns the number of supplementary group IDs associated with the calling process without modifying the array pointed to by gidset. >How-To-Repeat: # cat > test.c #include #include #include int main(int argc, char *argv[]) { gid_t gidset[NGROUPS_MAX]; int error; error = getgroups(NGROUPS_MAX, gidset); if (error) perror("getgroups"); return (0); } # gcc -o test test.c test.c: In function `main': test.c:7: `NGROUPS_MAX' undeclared (first use in this function) test.c:7: (Each undeclared identifier is reported only once test.c:7: for each function it appears in.) >Fix: Modify man page to include syslimits.h, replicate value into types.h, other bogosities of namespace, remove reference to NGROUPS_MAX in the man page. Note clear which is the worst. What does POSIX say about getgroups()? >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message