Skip to content
BSD syscall#243

svc · unix #243

initgroups

Initialises the supplementary group list from the user database.

Prototype

int initgroups(u_int gidsetsize, gid_t *gidset, int gmuid);

Returns: int

Arguments

NameTypeDirDescription
gidsetsizeu_int-
gidsetgid_t-
gmuidint-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard243
xnu-1486.2.11243
xnu-1504.15.3243
xnu-1504.3.12243
xnu-1504.7.4243
xnu-1504.9.17243
xnu-1504.9.26243
xnu-1504.9.37243

Notes

Libc helper that queries Open Directory for every group the named user belongs to and then calls setgroups(). On macOS, this query may hit the local DS, Active Directory, or other plugins, so it can block on network I/O. Like setgroups(), it requires effective root.

Related APIs

setgroupsgetgroupssetuidsetgidgetlogin