Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

setgroups(2)

initgroups(3x)

getgroups(2)

Name

getgroups − get group access list

Syntax

#include <sys/types.h>
#include <unistd.h>

int
getgroups(gidsetsize, gidset)
int gidsetsize;
gid_t *gidset;

Description

The getgroups call gets the current group access list of the user process and stores it in the array gidset. The gidsetsize parameter indicates the number of entries that can be placed in gidset and is modified on return to indicate the actual number of groups returned. 

Return Value

Upon success, the call returns the actual number of groups returned to array gidset. No more than NGROUPS, as defined in <sys/param.h>, are returned.

A value of −1 indicates that an error occurred, and the error code is stored in the global variable, errno.

Environment

POXIX

When your program is compiled in the POSIX environment, the gidset argument should be defined as follows: gid_tgidset[ ];

Additionally, in the POSIX environment, if the gidsetsize argument is zero, getgroups returns the number of supplemental group IDs associated with the calling process, without modifying the array pointed to by the gidset argument. 

Diagnostics

The getgroups call fails under the following conditions:

[EINVAL] The gidsetsize argument is smaller than the number of groups in the group set. 

[EFAULT] The gidset argument specifies invalid addresses. 

See Also

setgroups(2), initgroups(3x)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026