Penguin
Blame: setgroups(2)
EditPageHistoryDiffInfoLikePages
Annotated edit history of setgroups(2) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 GETGROUPS
2 !!!GETGROUPS
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 ERRORS
8 NOTES
9 CONFORMING TO
10 SEE ALSO
11 ----
12 !!NAME
13
14
15 getgroups, setgroups - get/set list of supplementary group IDs
16 !!SYNOPSIS
17
18
19 __#include __
20 #include __
21
22
23 __int getgroups(int__ ''size''__, gid_t__
24 ''list''__[[]);__
25
26
27 __#include __
28
29
30 __int setgroups(size_t__ ''size''__, const gid_t
31 *__''list''__);__
32 !!DESCRIPTION
33
34
35 __getgroups__
36
37
38 Up to ''size'' supplementary group IDs are returned in
39 ''list''. It is unspecified whether the effective group
40 ID of the calling process is included in the returned list.
41 (Thus, an application should also call getegid(2) and
42 add or remove the resulting value.) If ''size'' is zero,
43 ''list'' is not modified, but the total number of
44 supplementary group IDs for the process is
45 returned.
46
47
48 __setgroups__
49
50
51 Sets the supplementary group IDs for the process. Only the
52 super-user may use this function.
53 !!RETURN VALUE
54
55
56 __getgroups__
57
58
59 On success, the number of supplementary group IDs is
60 returned. On error, -1 is returned, and ''errno'' is set
61 appropriately.
62
63
64 __setgroups__
65
66
67 On success, zero is returned. On error, -1 is returned, and
68 ''errno'' is set appropriately.
69 !!ERRORS
70
71
72 __EFAULT__
73
74
75 ''list'' has an invalid address.
76
77
78 __EPERM__
79
80
81 For __setgroups__, the user is not the
82 super-user.
83
84
85 __EINVAL__
86
87
88 For __setgroups__, ''size'' is greater than
89 __NGROUPS__ (32 for Linux 2.0.32). For __getgroups__,
90 ''size'' is less than the number of supplementary group
91 IDs, but is not zero.
92 !!NOTES
93
94
95 A process can have up to at least NGROUPS_MAX supplementary
96 group IDs in addition to the effective group ID. The set of
97 supplementary group IDs is inherited from the parent process
98 and may be changed using __setgroups__. The maximum
99 number of supplementary group IDs can be found using
100 sysconf(3):
101
102
103 long ngroups_max;
104 ngroups_max = sysconf(_SC_NGROUPS_MAX);
105 The maximal return value of __getgroups__ cannot be larger than one more than the value obtained this way.
106
107
108 The prototype for __setgroups__ is only available if
109 ___BSD_SOURCE__ is defined (either explicitly, or
110 implicitly, by not defining _POSIX_SOURCE or compiling with
111 the -ansi flag).
112 !!CONFORMING TO
113
114
115 SVr4, SVID (issue 4 only; these calls were not present in
116 SVr3), X/OPEN, 4.3BSD. The __getgroups__ function is in
117 POSIX.1. Since __setgroups__ requires privilege, it is
118 not covered by POSIX.1.
119 !!SEE ALSO
120
121
122 initgroups(3), getgid(2),
123 setgid(2)
124 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.