initgroups() — Initialize the supplementary group ID list for the process
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
z/OS® UNIX | both |
Format
#define _OPEN_SYS
#include <sys/types.h>
#include <grp.h>
int initgroups(const char *user, const gid_t basegid);
General description
The initgroups() function obtains the supplementary group membership of user, and sets the current process supplementary group IDs to that list. The basegid is also included in the supplementary group IDs list.
The caller of this function must be a superuser or must specify the password of the target user name specified on the initgroups() call - issue the passwd() function before initgroups().
Returned value
If successful, initgroups() returns 0.
If unsuccessful, initgroups() returns -1 and sets errno
to one of the following values:
- Error Code
- Description
- EINVAL
- The number of supplementary groups for the specified user plus the basegid group exceeds the maximum number of groups allowed, or a non-valid user is specified.
- EMVSERR
- An MVS™ environmental or internal error occurred.
- EMVSSAF2ERR
- The Security Authorization Facility (SAF) had an error.
- EPERM
- The caller is not authorized, only authorized users are allowed to alter the supplementary group IDs list.