getgroups - get supplementary group IDs
#include <sys/types.h> #include <unistd.h> int getgroups(int gidsetsize, gid_t grouplist[]);
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.
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.
The getgroups() function will fail if:
- [EINVAL]
- The gidsetsize argument is non-zero and is less than the number of supplementary group IDs.
None.
None.
None.
getegid(), setgid(), <sys/types.h>, <unistd.h>.
Derived from the POSIX.1-1988 standard.