getgrouplist(3)

getgrouplist3

Calculate partial group access list

Usage

#include <unistd.h>

int

getgrouplist(const char *name, int basegid, int *groups, int *ngroups);

Library

Standard system libraries.

Overview

The getgrouplist() function obtains information from opendirectoryd(8) to construct the group access list for the user specified in name. The basegid is automatically included in the groups list. Typically this value is given as the default group number from the user's account record.

The resulting group list is returned in the array pointed to by groups. The caller specifies the size of the groups array in the integer pointed to by ngroups; the actual number of groups found is returned in ngroups.

Return values

The getgrouplist() function returns 0 on success. If the size of the group list is too small to hold all the user's groups, getgrouplist() returns -1 to indicate failure. In this case, the group array will be filled with as many groups as will fit.

Files

/etc/group

group membership list

Releases

163 releases since Mac OS X 10.0; the text changed 3 times.

  1. 10.0–10.1.5
  2. 10.2–10.5.8
  3. 10.6–10.9.5
  4. 10.10–26.5

History

The getgrouplist() function first appeared in 4.4BSD.

From Libinfo 600 in macOS 26.5. Parsed by carta from the page's mdoc source.