OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / draft / man3 / getpwent.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
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.
7 .\"
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.
12 .\"
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
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\"
30 .\" Modified Sat Jul 24 19:22:14 1993 by Rik Faith (faith@cs.unc.edu)
31 .\" Modified Mon May 27 21:37:47 1996 by Martin Schulze (joey@linux.de)
32 .\"
33 .\"*******************************************************************
34 .\"
35 .\" This file was generated with po4a. Translate the source file.
36 .\"
37 .\"*******************************************************************
38 .\"
39 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
40 .\"     all rights reserved.
41 .\" Translated 1997-12-18, HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
42 .\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
43 .\"
44 .TH GETPWENT 3 2013\-06\-21 GNU "Linux Programmer's Manual"
45 .SH 名前
46 getpwent, setpwent, endpwent \- パスワードファイルのエントリーの取得
47 .SH 書式
48 .nf
49 \fB#include <sys/types.h>\fP
50 \fB#include <pwd.h>\fP
51 .sp
52 \fBstruct passwd *getpwent(void);\fP
53 .sp
54 \fBvoid setpwent(void);\fP
55 .sp
56 \fBvoid endpwent(void);\fP
57 .fi
58 .sp
59 .in -4n
60 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
61 .in
62 .sp
63 .ad l
64 \fBgetpwent\fP(), \fBsetpwent\fP(), \fBendpwent\fP():
65 .RS 4
66 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
67 .RE
68 .ad b
69 .SH 説明
70 \fBgetpwent\fP()  関数は、パスワードデータベースから取得したエントリーを 要素毎に分解し、各要素を格納した構造体へのポインターを返す
71 (パスワードデータベースの例: ローカルのパスワードファイル \fI/etc/passwd\fP, NIS, LDAP)。 \fBgetpwent\fP()
72 は、最初に呼び出された時は最初のエントリーを返し、それ以降は 呼び出される毎に次のエントリーを返す。
73 .PP
74 \fBsetpwent\fP()  関数を使うと、パスワードデータベースの先頭に戻る。
75 .PP
76 \fBendpwent\fP()  関数は、全ての処理が終わった後にパスワード データベースをクローズする。
77 .PP
78 \fIpasswd\fP 構造体は、\fI<pwd.h>\fP で以下のように定義されている:
79 .sp
80 .in +4n
81 .nf
82 struct passwd {
83     char   *pw_name;       /* ユーザー名 */
84     char   *pw_passwd;     /* ユーザーのパスワード */
85     uid_t   pw_uid;        /* ユーザー ID */
86     gid_t   pw_gid;        /* グループ ID */
87     char   *pw_gecos;      /* ユーザー情報 */
88     char   *pw_dir;        /* ホームディレクトリ */
89     char   *pw_shell;      /* シェルプログラム */
90 };
91 .fi
92 .in
93 .PP
94 この構造体のフィールドの詳細は \fBpasswd\fP(5)  を参照のこと。
95 .SH 返り値
96 \fBgetpwent\fP()  関数は \fIpasswd\fP 構造体へのポインターを返す。 これ以上エントリーが無いか、エラーが発生した場合は NULL
97 を返す。 エラーが発生すると、 \fIerrno\fP が適切に設定される。 この関数の呼び出し後に \fIerrno\fP をチェックしたい場合は、呼び出し前に
98 \fIerrno\fP を 0 に設定しておかないといけない。
99
100 返り値は静的な領域を指しており、その後の \fBgetpwent\fP(), \fBgetpwnam\fP(3), \fBgetpwuid\fP(3)
101 の呼び出しで上書きされるかもしれない。 (返されたポインターを \fBfree\fP(3)  に渡さないこと。)
102 .SH エラー
103 .TP 
104 \fBEINTR\fP
105 シグナルが捕捉された。
106 .TP 
107 \fBEIO\fP
108 I/O エラー。
109 .TP 
110 \fBEMFILE\fP
111 呼び出し元プロセスがオープンしているファイル数が すでに上限 (\fBOPEN_MAX\fP)  であった。
112 .TP 
113 \fBENFILE\fP
114 システムでオープンされているファイル数がすでに上限であった。
115 .TP 
116 \fBENOMEM\fP
117 .\" not in POSIX
118 .\" to allocate the passwd structure, or to allocate buffers
119 \fIpasswd\fP 構造体に割り当てるメモリーが十分なかった。
120 .TP 
121 \fBERANGE\fP
122 与えられたバッファー空間が不十分である。
123 .SH ファイル
124 .TP 
125 \fI/etc/passwd\fP
126 ローカルのパスワードデータベースファイル
127 .SH 属性
128 .SS "マルチスレッディング (pthreads(7) 参照)"
129 \fBgetpwent\fP() 関数はスレッドセーフではない。
130 .LP
131 関数 \fBsetpwent\fP() と \fBendpwent\fP() はスレッドセーフである。
132 .SH 準拠
133 SVr4, 4.3BSD, POSIX.1\-2001.  \fIpw_gecos\fP フィールドは POSIX では規定されていないが、
134 ほとんどの実装に存在する。
135 .SH 関連項目
136 \fBfgetpwent\fP(3), \fBgetpw\fP(3), \fBgetpwent_r\fP(3), \fBgetpwnam\fP(3),
137 \fBgetpwuid\fP(3), \fBputpwent\fP(3), \fBpasswd\fP(5)
138 .SH この文書について
139 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
140 である。プロジェクトの説明とバグ報告に関する情報は
141 http://www.kernel.org/doc/man\-pages/ に書かれている。