| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 2: System Calls Oracle Solaris 11 Information Library |
- get or set supplementary group access list IDs
#include <unistd.h>intgetgroups(intgidsetsize,gid_t *grouplist);
intsetgroups(intngroups,const gid_t *grouplist);
Thegetgroups() function gets the current supplemental group access list of thecalling process and stores the result in the array of group IDsspecified bygrouplist. This array hasgidsetsize entries and must be largeenough to contain the entire list. This list cannot be larger thanNGROUPS_MAX.Ifgidsetsize equals 0,getgroups() will return the number of groups towhich the calling process belongs without modifying the array pointed to bygrouplist.
Thesetgroups() function sets the supplementary group access list of the callingprocess from the array of group IDs specified bygrouplist. The numberof entries is specified byngroups and can not be greater thanNGROUPS_MAX.
Upon successful completion,getgroups() returns the number of supplementary group IDs setfor the calling process andsetgroups() returns0. Otherwise,-1 is returnedanderrno is set to indicate the error.
Thegetgroups() andsetgroups() functions will fail if:
A referenced part of the array pointed to bygrouplist is an illegal address.
Thegetgroups() function will fail if:
The value ofgidsetsize is non-zero and less than the number of supplementary group IDs set for the calling process.
Thesetgroups() function will fail if:
The value ofngroups is greater than {NGROUPS_MAX}.
The {PRIV_PROC_SETID} privilege is not asserted in the effective set of the calling process.
Use of thesetgroups() function requires the {PRIV_PROC_SETID} privilege.
Seeattributes(5) for descriptions of the following attributes:
|
groups(1),chown(2),getuid(2),setuid(2),getgrnam(3C),initgroups(3C),attributes(5),privileges(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |