1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified Thu Oct 31 12:04:29 1996 by Eric S. Raymond <esr@thyrsus.com>
26 .\" Modified, 27 May 2004, Michael Kerrisk <mtk-manpages@gmx.net>
27 .\" Added notes on capability requirements
29 .TH GETGROUPS 2 2004-05-27 "Linux 2.6.6" "Linux Programmer's Manual"
31 getgroups, setgroups \- get/set list of supplementary group IDs
33 .B #include <sys/types.h>
35 .B #include <unistd.h>
37 .BI "int getgroups(int " size ", gid_t " list []);
41 .BI "int setgroups(size_t " size ", const gid_t *" list );
47 supplementary group IDs (of the calling process) are returned in
49 It is unspecified whether the effective group ID of the calling process
50 is included in the returned list.
51 (Thus, an application should also call
53 and add or remove the resulting value.)
58 is not modified, but the total number of supplementary group IDs for the
62 Sets the supplementary group IDs for the process.
63 Appropriate privileges (Linux: the
65 capability) are required.
69 On success, the number of supplementary group IDs is returned.
70 On error, \-1 is returned, and
75 On success, zero is returned.
76 On error, \-1 is returned, and
83 has an invalid address.
91 (32 for Linux 2.0.32).
95 is less than the number of supplementary group IDs, but is not zero.
98 The calling process has insufficient privilege to call
101 A process can have up to at least NGROUPS_MAX supplementary group IDs
102 in addition to the effective group ID.
103 The set of supplementary group IDs
104 is inherited from the parent process and may be changed using
106 The maximum number of supplementary group IDs can be found using
111 ngroups_max = sysconf(_SC_NGROUPS_MAX);
114 The maximal return value of
116 cannot be larger than one more than the value obtained this way.
127 function is in POSIX.1-2001.
130 requires privilege, it is not covered by POSIX.1-2001.