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@gmail.com>
27 .\" Added notes on capability requirements
28 .\" 2008-05-03, mtk, expanded and rewrote parts of DESCRIPTION and RETURN
29 .\" VALUE, made style of page more consistent with man-pages style.
31 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
32 .\" all rights reserved.
33 .\" Translated 1997-02-22, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
34 .\" Updated 2001-02-10, Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
35 .\" Updated & Modified 2004-12-30, Yuichi SATO <ysato444@yahoo.co.jp>
36 .\" Updated 2008-08-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
41 .\"WORD: super user スーパー・ユーザー
42 .\"WORD: supplementary group 補助グループ
44 .TH GETGROUPS 2 2008-06-03 "Linux" "Linux Programmer's Manual"
47 .\"O getgroups, setgroups \- get/set list of supplementary group IDs
48 getgroups, setgroups \- 補助グループ ID のリストを取得/設定する
51 .B #include <sys/types.h>
53 .B #include <unistd.h>
55 .BI "int getgroups(int " size ", gid_t " list []);
59 .BI "int setgroups(size_t " size ", const gid_t *" list );
62 .\"O Feature Test Macro Requirements for glibc (see
63 .\"O .BR feature_test_macros (7)):
65 .RB ( feature_test_macros (7)
75 .\"O returns the supplementary group IDs of the calling process in
79 .\"O should be set to the maximum number of items that can be stored in the
80 .\"O buffer pointed to by
82 .\"O If the calling process is a member of more than
84 .\"O supplementary groups, then an error results.
86 は呼び出し元プロセスの補助グループ (supplementary group) ID を
92 により参照されるバッファに格納できる要素の最大数を設定すべきである。
95 個より多くの補助グループのメンバの場合には、エラーとなる。
96 .\"O It is unspecified whether the effective group ID of the calling process
97 .\"O is included in the returned list.
98 .\"O (Thus, an application should also call
100 .\"O and add or remove the resulting value.)
101 この関数を呼び出したプロセスの実効グループ ID が、
102 返されるリストに含まれるかどうかは規定されていない
105 を呼び出し、その結果の値を追加・削除すべきである)。
111 .\"O is not modified, but the total number of supplementary group IDs for the
112 .\"O process is returned.
116 は修正されないが、そのプロセスの補助グループ ID の合計数が返される。
117 .\"O This allows the caller to determine the size of a dynamically allocated
119 .\"O to be used in a further call to
120 .\"O .BR getgroups ().
123 の呼び出しで必要となる動的割り当てバッファ
125 のサイズを、呼び出し元が決定することができる。
127 .\"O .BR setgroups ()
128 .\"O sets the supplementary group IDs for the calling process.
129 .\"O Appropriate privileges (Linux: the
131 .\"O capability) are required.
133 は、呼び出し元プロセスの補助グループ ID を設定する。
136 ケーパビリティ (capability)) が必要である。
139 .\"O argument specifies the number of supplementary group IDs
140 .\"O in the buffer pointed to by
145 により参照されるバッファに格納された補助グループ ID の数を指定する。
146 .\"O .SH "RETURN VALUE"
149 .\"O .BR getgroups ()
150 .\"O returns the number of supplementary group IDs.
151 .\"O On error, \-1 is returned, and
153 .\"O is set appropriately.
155 は、成功すると補助グループ ID の数を返す。
161 .\"O .BR setgroups ()
163 .\"O On error, \-1 is returned, and
165 .\"O is set appropriately.
176 .\"O has an invalid address.
180 .\"O .BR getgroups ()
181 .\"O can additionally fail with the following error:
183 は、上記に加えて以下のエラーで失敗する可能性がある。
187 .\"O is less than the number of supplementary group IDs, but is not zero.
189 が補助グループ ID の数より小さいが 0 でない。
191 .\"O .BR setgroups ()
192 .\"O can additionally fail with the following errors:
194 は、上記に加えて以下のエラーで失敗する可能性がある。
200 .\"O (32 before Linux 2.6.4; 65536 since Linux 2.6.4).
206 は Linux 2.6.4 より前では 32、Linux 2.6.4 以降では 65536)。
213 .\"O The calling process has insufficient privilege.
214 呼び出し元プロセスが十分な特権を持っていない。
215 .\"O .SH "CONFORMING TO"
219 .\"O .BR getgroups ()
220 .\"O function is in POSIX.1-2001.
222 .\"O .BR setgroups ()
223 .\"O requires privilege, it is not covered by POSIX.1-2001.
226 関数は POSIX.1-2001 に準拠している。
228 は特権を必要とするため、POSIX.1-2001 に従っていない。
231 .\"O A process can have up to
233 .\"O supplementary group IDs
234 .\"O in addition to the effective group ID.
235 .\"O The set of supplementary group IDs
236 .\"O is inherited from the parent process, and preserved across an
238 プロセスは、実効グループ ID に加え、最大
240 までの補助グループ ID を持つことができる。
241 補助グループ ID の集合は親プロセスから継承され、
245 .\"O The maximum number of supplementary group IDs can be found using
246 .\"O .BR sysconf (3):
249 を使って以下のようにして調べることができる:
253 ngroups_max = sysconf(_SC_NGROUPS_MAX);
256 .\"O The maximum return value of
257 .\"O .BR getgroups ()
258 .\"O cannot be larger than one more than this value.
260 の返り値の最大値は、この値より 1 大きい値より大きくなることはない。
265 .BR getgrouplist (3),
267 .BR capabilities (7),