Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

setgroups(2) OSS System Calls Reference Manual
NAME
setgroups - Sets the group list of the calling process
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsecsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zsecdll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ysecdll
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <unistd.h>
int setgroups(
int ngroups,
const gid_t *gidset);
PARAMETERS
ngroups Indicates the number of entries in the array pointed to by the gidset parameter.
Must be no greater than the value of NGROUPS_MAX, which is defined in the
<limits.h> header file.
gidset Points to the array of the group list that is to be set for the calling process.
DESCRIPTION
The setgroups() function sets the group list of the calling process according to the array pointed
to by the gidset parameter. The ngroups parameter indicates the number of entries in the array,
and must not exceed the value of NGROUPS_MAX, which is defined in the <limits.h> header
file.
The calling process must have the appropriate privileges to use this function.
NOTES
This function is supported on systems running J06.07 and later J-series RVUs, H06.18 and later
H-series RVUs, and G06.33 and later G-series RVUs.
RETURN VALUES
Upon successful completion, the setgroups( ) function returns the value 0 (zero). Otherwise, the
value -1 is returned and errno is set to indicate the error.
ERRORS
If any of these conditions occur, the setgroups( ) function sets errno to the corresponding value:
[EINVAL] The value of the ngroups parameter is greater than the value of
NGROUPS_MAX or is not a positive number, or an entry in the array pointed to
by the gidset parameter is not a valid group ID.
[EPERM] The process lacks appropriate privileges.
RELATED INFORMATION
Functions: getgroups(2), initgroups(3).
STANDARDS CONFORMANCE
This function conforms to the Application Environment Specification (AES) and the System V
Interface Definition, version 3 (SVID3).
760 Hewlett-Packard Company 527186-023