NAME
getgroups — get
supplementary group IDs
SYNOPSIS
#include <sys/types.h> #include <unistd.h> int getgroups(int gidsetsize, gid_t grouplist[]);
DESCRIPTION
The getgroups() function fills in the array grouplist with the current supplementary group IDs of the calling process.
The gidsetsize argument specifies the number of elements in the array grouplist. The actual number of supplementary group IDs stored in the array is returned. The values of array entries with indices greater than or equal to the value returned are undefined.
If gidsetsize is 0, getgroups() returns the number of supplementary group IDs associated with the calling process without modifying the array pointed to by grouplist.
It is unspecified whether the effective group ID of the calling process is included in, or omitted from, the returned list of supplementary group IDs.
RETURN VALUE
Upon successful completion, the number of supplementary group IDs is returned. A return value of -1 indicates failure and errno is set to indicate the error.
ERRORS
The getgroups() function will fail if:
- [EINVAL]
- The gidsetsize argument is non-zero and is less than the number of supplementary group IDs.
EXAMPLES
None.
APPLICATION USAGE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
getegid(3) , setgid(3) , <sys/types.h> , <unistd.h> .
DERIVATION
Derived from the POSIX.1-1988 standard.