![]() |
![]() |
![]() |
Determine the group access list for a user
#include <unistd.h> int getgrouplist( const char *name, gid_t basegid, gid_t *groups, int *ngroups );
libc
The getgrouplist() function reads the group file and determines the group access list for the user specified in name. The basegid is automatically included in the list of groups. Typically this value is given as the group number from the password file.
The resulting group list is returned in the integer array pointed to by groups. The ngroups argument specifies the size of the groups array, and is set by this function to be the actual number of groups found.
-1 if the size of the group list is too small to hold all the user's groups. The group array is filled with as many groups as fit.
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
The getgrouplist() function uses the routines based on getgrent(). If the invoking program uses any of these routines, the group structure will be overwritten in the call to getgrouplist().
![]() |
![]() |
![]() |