DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

getgroups(S-osr5)


getgroups -- get supplementary group ID's

Syntax

cc . . . -lc

#include  <sys/types.h>

int getgroups (gidsetsize, grouplist) int gidsetsize; gid_t grouplist[];

Description

The getgroups routine fills in the array argument grouplist with the supplementary group IDs of the calling process. This does not include the effective group ID of the calling process itself, unless that is one of the group IDs set by setgroups(S-osr5). The argument gidsetsize sets the maximum number of elements in the supplied array grouplist. The actual number of supplementary group IDs is returned. The values of the array entries with indices larger than or equal to the returned value are undefined since the array grouplist will have overflowed.

As a special case, if the argument gidsetsize is zero, getgroups returns the number of supplemental group IDs associated with the calling process without modifying the array to which the argument grouplist points.

Return values

Upon successful completion, the getgroups routine returns the number of supplementary group IDs. This value is zero if {NGROUPS_MAX} is zero. If getgroups fails, a value of -1 is returned and errno is set to indicate the error.

Diagnostics

If one of the following conditions occurs, getgroups returns a value of -1 and errno is set to the corresponding value:


[EINVAL]
The gidsetsize argument is not equal to zero and is less than the number of supplementary group IDs.

See also

getgroups(S-osr5), initgroups(S-osr5), setgroups(S-osr5)

Standards conformance

getgroups conforms with:

X/Open Portability Guide, Issue 3, 1989 ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005