INITGROUPS(3) | Library Functions Manual | INITGROUPS(3) |
initgroups
—
initialize group access list
Standard system libraries.
#include
<unistd.h>
int
initgroups
(const
char *name, int
basegid);
The
initgroups
()
function calculates a group access list for the user specified in
name. This group list is then saved in the kernel
credentials for the current process. The basegid is
included in the groups list. Typically this value is given as the default
group associated with the user's account record.
This function sets at most 16 group IDs in the process
credentials. This list can be retrieved using the
getgroups(2) function. Note that OS
X supports group membership in an unlimited number of groups. The OS X
kernel uses the group list stored in the process credentials only as an
initial cache. Additional group memberships are determined by communication
between the operating system and the opendirectoryd
daemon.
Processes should not use the group ID numbers from
getgroups(2) to determine a user's
group membership. The list obtained from
getgroups
()
may only be a partial list of a user's group membership. Membership checks
should use the
mbr_gid_to_uuid(3),
mbr_uid_to_uuid(3), and
mbr_check_membership(3)
functions.
The initgroups
() function returns 0 on
success. On failure, this function will return -1 and set
errno to one of the following values:
EPERM
]EINVAL
]EFAULT
]getgroups(2), getgrouplist(3), mbr_gid_to_uuid(3), mbr_uid_to_uuid(3), mbr_check_membership(3).
The initgroups
() function appeared in
4.2BSD.
June 4, 1993 | macOS 15.0 |