Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (f - i) getgroups(2)
NAME
getgroups - Gets the group list of the current 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 <unistd.h>
#include <sys/types.h>
int getgroups(
int gidsetsize,
gid_t grouplist [ ]);
PARAMETERS
gidsetsize Specifies the number of entries that can be stored in the array pointed to by the
grouplist parameter.
grouplist Points to the array in which the group list of the process is stored.
DESCRIPTION
The getgroups() function gets the group list of the current process. The list is stored in the array
pointed to by the grouplist parameter. The gidsetsize parameter indicates the number of entries
that can be stored in this array.
The getgroups() function never returns more than NGROUPS_MAX entries.
(NGROUPS_MAX is a constant defined in the limits.h header file.) If the gidsetsize parameter
is 0 (zero), the getgroups( ) function returns the number of groups in the group list.
The effective group ID may not occur in the returned group ID list if the effective group ID has
been changed by executing a set-group-ID program or by calling the setgid() function.
RETURN VALUES
Upon successful completion, the getgroups( ) function returns the number of elements stored in
the array pointed to by the grouplist parameter. If getgroups( ) fails, then the value -1 is returned
and errno is set to indicate the error.
The value 0 (zero) is returned when the authentication information for a process is uninitialized.
ERRORS
If any of these conditions occur, the getgroups() function sets errno to the corresponding value:
[EFAULT] The gidsetsize and grouplist parameters specify an array that is partially or com-
pletely outside the allocated address space of the process.
[EINVAL] The gidsetsize parameter is nonzero and smaller than the number of groups in the
group list, or the grouplist parameter is out of range.
RELATED INFORMATION
Commands: id(1).
527186-023 Hewlett-Packard Company 3−73