OSDN Git Service

0ff9374593442ea3c5e92874783df9d312144148
[linuxjm/LDP_man-pages.git] / draft / man3 / getgrent.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 19:29:54 1993 by Rik Faith (faith@cs.unc.edu)
28 .\"
29 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
30 .\"     all rights reserved.
31 .\" Translated 1997-12-19, HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
32 .\" Updated & Modified 2004-05-30, Yuichi SATO <ysato444@yahoo.co.jp>
33 .\" Updated & Modified 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\"
35 .TH GETGRENT 3  2010-10-21 "" "Linux Programmer's Manual"
36 .\"O .SH NAME
37 .SH 名前
38 .\"O getgrent, setgrent, endgrent \- get group file entry
39 getgrent, setgrent, endgrent \- グループファイルエントリの取得
40 .\"O .SH SYNOPSIS
41 .SH 書式
42 .nf
43 .B #include <sys/types.h>
44 .B #include <grp.h>
45 .sp
46 .B struct group *getgrent(void);
47 .sp
48 .B void setgrent(void);
49 .sp
50 .B void endgrent(void);
51 .fi
52 .sp
53 .in -4n
54 .\"O Feature Test Macro Requirements for glibc (see
55 .\"O .BR feature_test_macros (7)):
56 glibc 向けの機能検査マクロの要件
57 .RB ( feature_test_macros (7)
58 参照):
59 .in
60 .sp
61 .PD 0
62 .ad l
63 .BR setgrent ():
64 .RS 4
65 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
66 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED ||
67 .br
68 /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
69 .RE
70 .sp
71 .BR getgrent (),
72 .BR endgrent ():
73 .RS 4
74 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
75 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
76 .RE
77 .PD
78 .ad b
79 .\"O .SH DESCRIPTION
80 .SH 説明
81 .\"O The
82 .\"O .BR getgrent ()
83 .\"O function returns a pointer to a structure containing
84 .\"O the broken-out fields of a record in the group database
85 .\"O (e.g., the local group file
86 .\"O .IR /etc/group ,
87 .\"O NIS, and LDAP).
88 .\"O The first time
89 .\"O .BR getgrent ()
90 .\"O is called,
91 .\"O it returns the first entry; thereafter, it returns successive entries.
92 .BR getgrent ()
93 関数は、グループ・データベースから取得したエントリを
94 要素毎に分解し、各要素を格納した構造体へのポインタを返す
95 (グループ・データベースの例:
96 ローカルのグループファイル
97 .IR /etc/group ,
98 NIS, LDAP)。
99 .BR getgrent ()
100 は、最初に呼び出された時は最初のエントリを返し、
101 それ以降は呼び出される毎に次のエントリを返す。
102 .PP
103 .\"O The
104 .\"O .BR setgrent ()
105 .\"O function rewinds to the beginning
106 .\"O of the group database, to allow repeated scans.
107 .BR setgrent ()
108 関数を使うと、もう一度読み込めるように、
109 グループ・データベースの先頭に戻る。
110 .PP
111 .\"O The
112 .\"O .BR endgrent ()
113 .\"O function is used to close the group database
114 .\"O after all processing has been performed.
115 .BR endgrent ()
116 関数は、全ての処理が終わった後にグループ・
117 データベースをクローズする。
118 .PP
119 .\"O The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows:
120 \fIgroup\fP 構造体は、\fI<grp.h>\fP で以下のように定義されている:
121 .sp
122 .in +4n
123 .nf
124 struct group {
125 .\"O     char   *gr_name;       /* group name */
126 .\"O     char   *gr_passwd;     /* group password */
127 .\"O     gid_t   gr_gid;        /* group ID */
128 .\"O     char  **gr_mem;        /* group members */
129     char   *gr_name;       /* グループ名 */
130     char   *gr_passwd;     /* グループのパスワード */
131     gid_t   gr_gid;        /* グループ ID */
132     char  **gr_mem;        /* グループのメンバ */
133 };
134 .fi
135 .in
136 .PP
137 .\"O For more information about the fields of this structure, see
138 .\"O .BR group (5).
139 この構造体のフィールドの詳細は
140 .BR group (5)
141 を参照のこと。
142 .\"O .SH "RETURN VALUE"
143 .SH 返り値
144 .\"O The
145 .\"O .BR getgrent ()
146 .\"O function returns a pointer to a
147 .\"O .I group
148 .\"O structure,
149 .\"O or NULL if there are no more entries or an error occurs.
150 .BR getgrent ()
151 関数は
152 .I group
153 構造体へのポインタを返す。
154 これ以上エントリが無いか、エラーが発生した場合は NULL を返す。
155 .LP
156 .\"O Upon error,
157 .\"O .I errno
158 .\"O may be set.
159 .\"O If one wants to check
160 .\"O .I errno
161 .\"O after the call, it should be set to zero before the call.
162 エラーが発生すると、
163 .I errno
164 が適切に設定される。
165 この関数の呼び出し後に
166 .I errno
167 をチェックしたい場合は、呼び出し前に
168 .I errno
169 を 0 に設定しておかないといけない。
170
171 .\"O The return value may point to a static area, and may be overwritten
172 .\"O by subsequent calls to
173 .\"O .BR getgrent (),
174 .\"O .BR getgrgid (3),
175 .\"O or
176 .\"O .BR getgrnam (3).
177 .\"O (Do not pass the returned pointer to
178 .\"O .BR free (3).)
179 返り値は静的な領域を指しており、その後の
180 .BR getgrent (),
181 .BR getgrgid (3),
182 .BR getgrnam (3)
183 の呼び出しで上書きされるかもしれない。
184 (返されたポインタを
185 .BR free (3)
186 に渡さないこと。)
187 .\"O .SH ERRORS
188 .SH エラー
189 .TP
190 .B EINTR
191 .\"O A signal was caught.
192 シグナルがキャッチされた。
193 .TP
194 .B EIO
195 .\"O I/O error.
196 I/O エラー。
197 .TP
198 .B EMFILE
199 .\"O The calling process already has too many open files.
200 呼び出したプロセスが既にファイルをオープンし過ぎている。
201 .TP
202 .B ENFILE
203 .\"O Too many open files in the system.
204 システム上にオープンされたファイルが多過ぎる。
205 .TP
206 .B ENOMEM
207 .\"O .\" not in POSIX
208 .\"O Insufficient memory to allocate
209 .\"O .I group
210 .\"O structure.
211 .\" POSIX にはない。
212 .I group
213 構造体を割り当てるためのメモリが不十分。
214 .TP
215 .B ERANGE
216 .\"O Insufficient buffer space supplied.
217 十分なバッファ空間がない。
218 .SH ファイル
219 .TP
220 .I /etc/group
221 .\"O local group database file
222 ローカルのグループ・データベースファイル
223 .\"O .SH "CONFORMING TO"
224 .SH 準拠
225 SVr4, 4.3BSD, POSIX.1-2001.
226 .\"O .SH "SEE ALSO"
227 .SH 関連項目
228 .BR fgetgrent (3),
229 .BR getgrent_r (3),
230 .BR getgrgid (3),
231 .BR getgrnam (3)
232 .BR getgrouplist (3),
233 .BR putgrent (3),
234 .BR group (5)