nix::unistd

Function getgrouplist

Source
pub fn getgrouplist(user: &CStr, group: Gid) -> Result<Vec<Gid>>
Expand description

Calculate the supplementary group access list.

Gets the group IDs of all groups that user is a member of. The additional group group is also added to the list.

Further reading

Note: This function is not available for Apple platforms. On those platforms, checking group membership should be achieved via communication with the opendirectoryd service.

ยงErrors

Although the getgrouplist() call does not return any specific errors on any known platforms, this implementation will return a system error of EINVAL if the number of groups to be fetched exceeds the NGROUPS_MAX sysconf value. This mimics the behaviour of getgroups() and setgroups(). Additionally, while some implementations will return a partial list of groups when NGROUPS_MAX is exceeded, this implementation will only ever return the complete list or else an error.