setgroups() — Set 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 setgroups(const int size, const gid_t list[]);

General description

setgroups() sets the supplementary group IDs for the process to the list provided in the list array. The argument size gives the number of gid_t elements in list array. The maximum number of supplementary groups for a strictly conforming program is NGROUPS_MAX, as defined in <limits.h> Or, refer to sysconf() (see sysconf() — Determine system configuration options) for information on dynamically determining the number of supplementary groups allowed.

The caller of this function must be a superuser.

Returned value

If successful, setgroups() returns 0.

If unsuccessful, setgroups() returns -1 and sets errno to one of the following values:
Error Code
Description
EFAULT
The list and size specify an array that is partially or completely outside of addressable storage for the process.
EINVAL
The size parameter is greater than the maximum allowed.
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.

Related information