getgrouplist

Name

getgrouplist -- get network group entry

Synopsis

#include <grp.h>

int getgrouplist(const char * user, gid_t group, gid_t * groups, int * ngroups);

Description

The getgrouplist() function shall fill in the array groups with the supplementary groups for the user specified by user. On entry, ngroups shall refer to an integer containing the maximum number of gid_t members in the groups array. The group group shall also be included. On success, the value referred to by ngroups shall be updated to contain the number of gid_t objects copied.

Return Value

On success, if there was sufficient room to copy all the supplementatry group identifiers to the array identified by groups, getgrouplist() shall return the number of gid_t objects copied, and the value referenced by ngroups shall be updated. If there was not sufficient room to copy all the supplementary group identifiers, grouplist() shall return -1, and update the value referenced by ngroups to the number actually copied.

If user does not refer to a valid user on the system, getgrouplist() shall return 0, and set the value referenced by ngroups to 0.

Errors

None defined.

See Also

getgroups()