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"
46 getgroups, setgroups \- 補助グループ ID のリストを取得/設定する
48 .B #include <sys/types.h>
50 .B #include <unistd.h>
52 .BI "int getgroups(int " size ", gid_t " list []);
56 .BI "int setgroups(size_t " size ", const gid_t *" list );
60 .RB ( feature_test_macros (7)
69 は呼び出し元プロセスの補助グループ (supplementary group) ID を
75 により参照されるバッファに格納できる要素の最大数を設定すべきである。
78 個より多くの補助グループのメンバの場合には、エラーとなる。
79 この関数を呼び出したプロセスの実効グループ ID が、
80 返されるリストに含まれるかどうかは規定されていない
83 を呼び出し、その結果の値を追加・削除すべきである)。
88 は修正されないが、そのプロセスの補助グループ ID の合計数が返される。
93 のサイズを、呼び出し元が決定することができる。
96 は、呼び出し元プロセスの補助グループ ID を設定する。
99 ケーパビリティ (capability)) が必要である。
103 により参照されるバッファに格納された補助グループ ID の数を指定する。
106 は、成功すると補助グループ ID の数を返す。
123 は、上記に加えて以下のエラーで失敗する可能性がある。
127 が補助グループ ID の数より小さいが 0 でない。
130 は、上記に加えて以下のエラーで失敗する可能性がある。
138 は Linux 2.6.4 より前では 32、Linux 2.6.4 以降では 65536)。
144 呼び出し元プロセスが十分な特権を持っていない。
148 関数は POSIX.1-2001 に準拠している。
150 は特権を必要とするため、POSIX.1-2001 に従っていない。
152 プロセスは、実効グループ ID に加え、最大
154 までの補助グループ ID を持つことができる。
155 補助グループ ID の集合は親プロセスから継承され、
161 を使って以下のようにして調べることができる:
165 ngroups_max = sysconf(_SC_NGROUPS_MAX);
169 の返り値の最大値は、この値より 1 大きい値より大きくなることはない。
173 .BR getgrouplist (3),
175 .BR capabilities (7),