Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getgroups(2) — HP-UX 7.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

setgroups(2)

initgroups(3C)

GETGROUPS(2)

NAME

getgroups − get group access list

SYNOPSIS

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

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

DESCRIPTION

Getgroups gets the current group access list of the user process and stores it in the array gidset. The parameter ngroups indicates the number of entries which may be placed in gidset.  No more than NGROUPS, as defined in <sys/param.h>, will ever be returned.

As a special case, if the ngroups argument is zero, getgroups returns the number of group entries for the process.  In this case, the array pointed to by the gidset argument is not modified. 

EXAMPLES

The following call to getgroups(2) retrieves the group access list of the calling process and stores the group ids in array mygidset:

int ngroups = NGROUPS;
gid_t mygidset[NGROUPS];
int ngrps;

ngrps = getgroups (ngroups, mygidset);

RETURN VALUE

A non-negative value indicates that the call succeeded, and is the number of elements returned in gidset.  A value of −1 indicates that an error occurred, and the error code is stored in the global variable errno.

ERRORS

The possible errors for getgroups are:

[EFAULT] Gidset specifies an invalid address.  The reliable detection of this error will be implementation dependent. 

[EINVAL] The argument ngroups is not zero and is less than the number of groups in the current group access list of the process. 

AUTHOR

Getgroups was developed by HP and the University of California, Berkeley

SEE ALSO

setgroups(2), initgroups(3C)

STANDARDS CONFORMANCE

getgroups: XPG3, POSIX.1, FIPS 151-1

Hewlett-Packard Company  —  HP-UX Release 7.0: Sept 1989

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