Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
getgroups - get supplementary group IDs
&pagelevel(4)&pagelevel
Syntax | #include <unistd.h> Optional #include <sys/types.h> (End) int getgroups(int gidsetsize, gid_t grouplist[ ]); |
Description | getgroups() determines the current supplementary group IDs of the calling process and stores the result in the array grouplist.
gidsetsize specifies the number of elements in the array grouplist and must be large enough to accept the complete list. This list cannot be greater than {NGROUPS_MAX }. 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. |
Return val. | Number of supplementary group IDs |
| if successful. The return value is non-zero or less than the number of group IDs for the calling process. |
-1 | if unsuccessful. errno is set to indicate the error. |
Errors | getgroups() fails if:
|
EINVAL
| The value of gidsetsize is non-zero or less than gr_number for the calling process. |
Notes | The effective group ID of the calling process is included in grouplist. |
See also | getegid() , getuid() , setgid() , sys/types.h , unistd.h , and the manual "POSIX Basics" [1 (Related publications)].
|