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, grouplist)
int gidsetsize;
int grouplist[];

Description

The getgroups call gets the current group access list of the user process and stores it in the array of int grouplist. The gidsetsize parameter indicates the number of entries that can be placed in grouplist.

Return Values

Upon success, the call returns the number of groups as the value of the function.  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.

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 grouplist argument specifies invalid addresses. 

Environment

POSIX

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

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 grouplist argument. 

See Also

setgroups(2), initgroups(3x)

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