getgroups(2) [osf1 man page]
getgroups(2) System Calls Manual getgroups(2) NAME
getgroups - Gets the supplementary group IDs of the current process SYNOPSIS
#include <unistd.h> int getgroups( int gidsetsize, gid_t grouplist[]); Application developers may want to specify an #include statement for <sys/types.h> before the one for <unistd.h> if programs are being developed for multiple platforms. The additional #include statement is not required on Tru64 UNIX systems or by ISO or X/Open standards, but may be required on other vendors' systems that conform to these standards. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: getgroups(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Indicates the number of entries that can be stored in the array pointed to by the grouplist parameter. Points to the array in which the process' supplementary group IDs are stored. Element grouplist[0] is the effective group ID of the process. DESCRIPTION
The getgroups() function gets the current supplementary group IDs of the calling 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 supplementary group IDs associated with the calling process without modifying the array pointed to by grouplist. RETURN VALUES
Upon successful completion, the getgroups() function returns the number of elements stored in the array pointed to by the grouplist parame- ter. Otherwise, the function returns a value of -1 and sets errno to indicate the error. ERRORS
If the getgroups() function fails, errno might be set to one of the following values: [Tru64 UNIX] The gidsetsize and grouplist parameters specify an array that is partially or completely outside of the allocated address space of the process. The gidsetsize parameter is nonzero and smaller than the number of supplementary group IDs. RELATED INFORMATION
Commands: groups(1) Functions: setgroups(2), getgid(2), setsid(2), initgroups(3) Standards: standards(5) delim off getgroups(2)
Check Out this Related Man Page
getgroups(2) System Calls getgroups(2) NAME
getgroups, setgroups - get or set supplementary group access list IDs SYNOPSIS
#include <unistd.h> int getgroups(int gidsetsize, gid_t *grouplist); int setgroups(int ngroups, const gid_t *grouplist); DESCRIPTION
The getgroups() function gets the current supplemental group access list of the calling process and stores the result in the array of group IDs specified by grouplist. This array has gidsetsize entries and must be large enough to contain the entire list. This list cannot be larger than NGROUPS_MAX. If gidsetsize equals 0, getgroups() will return the number of groups to which the calling process belongs without modifying the array pointed to by grouplist. The setgroups() function sets the supplementary group access list of the calling process from the array of group IDs specified by grou- plist. The number of entries is specified by ngroups and can not be greater than NGROUPS_MAX. RETURN VALUES
Upon successful completion, getgroups() returns the number of supplementary group IDs set for the calling process and setgroups() returns 0. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The getgroups() and setgroups() functions will fail if: EFAULT A referenced part of the array pointed to by grouplist is an illegal address. The getgroups() function will fail if: EINVAL The value of gidsetsize is non-zero and less than the number of supplementary group IDs set for the calling process. The setgroups() function will fail if: EINVAL The value of ngroups is greater than {NGROUPS_MAX}. EPERM The {PRIV_PROC_SETID} privilege is not asserted in the effective set of the calling process. USAGE
Use of the setgroups() function requires the {PRIV_PROC_SETID} privilege. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |getgroups() is Standard. | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
groups(1), chown(2), getuid(2), setuid(2), getgrnam(3C), initgroups(3C), attributes(5), privileges(5), standards(5) SunOS 5.10 1 Feb 2003 getgroups(2)