1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
29 .\" Modified Sat Jul 24 19:29:54 1993 by Rik Faith (faith@cs.unc.edu)
30 .\"*******************************************************************
32 .\" This file was generated with po4a. Translate the source file.
34 .\"*******************************************************************
36 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
37 .\" all rights reserved.
38 .\" Translated 1997-12-19, HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
39 .\" Updated & Modified 2004-05-30, Yuichi SATO <ysato444@yahoo.co.jp>
40 .\" Updated & Modified 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
42 .TH GETGRENT 3 2014\-10\-02 "" "Linux Programmer's Manual"
44 getgrent, setgrent, endgrent \- グループファイルエントリーの取得
47 \fB#include <sys/types.h>\fP
48 \fB#include <grp.h>\fP
50 \fBstruct group *getgrent(void);\fP
52 \fBvoid setgrent(void);\fP
54 \fBvoid endgrent(void);\fP
58 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照):
65 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED ||
67 /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
70 \fBgetgrent\fP(), \fBendgrent\fP():
72 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
77 \fBgetgrent\fP() 関数は、グループデータベースから取得したエントリーを 要素毎に分解し、各要素を格納した構造体へのポインターを返す
78 (グループデータベースの例: ローカルのグループファイル \fI/etc/group\fP, NIS, LDAP)。 \fBgetgrent\fP()
79 は、最初に呼び出された時は最初のエントリーを返し、 それ以降は呼び出される毎に次のエントリーを返す。
81 \fBsetgrent\fP() 関数を使うと、もう一度読み込めるように、 グループデータベースの先頭に戻る。
83 \fBendgrent\fP() 関数は、全ての処理が終わった後にグループ データベースをクローズする。
85 \fIgroup\fP 構造体は \fI<grp.h>\fP で以下のように定義されている:
90 char *gr_name; /* グループ名 */
91 char *gr_passwd; /* グループのパスワード */
92 gid_t gr_gid; /* グループ ID */
93 char **gr_mem; /* グループのメンバ名へのポインター
99 この構造体のフィールドの詳細は \fBgroup\fP(5) を参照のこと。
101 \fBgetgrent\fP() 関数は \fIgroup\fP 構造体へのポインターを返す。 これ以上エントリーが無いか、エラーが発生した場合は NULL
104 エラーが発生すると、 \fIerrno\fP が適切に設定される。 この関数の呼び出し後に \fIerrno\fP をチェックしたい場合は、呼び出し前に
105 \fIerrno\fP を 0 に設定しておかないといけない。
107 返り値は静的な領域を指しており、その後の \fBgetgrent\fP(), \fBgetgrgid\fP(3), \fBgetgrnam\fP(3)
108 の呼び出しで上書きされるかもしれない。 (返されたポインターを \fBfree\fP(3) に渡さないこと。)
112 サービスが一時的に利用できなかったこと。あとでもう一度試してほしい。 NSS バックエンドの場合、glibc
113 では、バックエンドとの通信中に一時的なエラーが発生したことを示す。 このエラーは直るかもしれないので、あとでもう一度試すよう提案している。
122 呼び出したプロセスが既にファイルをオープンし過ぎている。
125 システム上にオープンされたファイルが多過ぎる。
129 必要な入力ファイルが見つからなかった。 NSS バックエンドの場合、glibc では、このエラーはバックエンドが正しく設定されていないことを示す。
133 \fIgroup\fP 構造体を割り当てるためのメモリーが不十分。
142 .SS "マルチスレッディング (pthreads(7) 参照)"
143 \fBgetgrent\fP() 関数はスレッドセーフではない。
145 関数 \fBsetgrent\fP() と \fBendgrent\fP() はスレッドセーフである。
147 SVr4, 4.3BSD, POSIX.1\-2001.
149 \fBfgetgrent\fP(3), \fBgetgrent_r\fP(3), \fBgetgrgid\fP(3), \fBgetgrnam\fP(3)
150 \fBgetgrouplist\fP(3), \fBputgrent\fP(3), \fBgroup\fP(5)
152 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.78 の一部
153 である。プロジェクトの説明とバグ報告に関する情報は
154 http://www.kernel.org/doc/man\-pages/ に書かれている。