OSDN Git Service

ec1f5068976c1f033ca698b1cb98e80d76b597fe
[linuxjm/LDP_man-pages.git] / draft / man3 / login.3
1 .\" This is free documentation; you can redistribute it and/or
2 .\" modify it under the terms of the GNU General Public License as
3 .\" published by the Free Software Foundation; either version 2 of
4 .\" the License, or (at your option) any later version.
5 .\"
6 .\" The GNU General Public License's references to "object code"
7 .\" and "executables" are to be interpreted as the output of any
8 .\" document formatting or typesetting system, including
9 .\" intermediate and printed output.
10 .\"
11 .\" This manual is distributed in the hope that it will be useful,
12 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
13 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 .\" GNU General Public License for more details.
15 .\"
16 .\" You should have received a copy of the GNU General Public
17 .\" License along with this manual; if not, write to the Free
18 .\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
19 .\" USA.
20 .\"
21 .\" Derived from text written by Martin Schulze (or taken from glibc.info)
22 .\" and text written by Paul Thompson - both copyright 2002.
23 .\"
24 .\" Japanese Version Copyright (c) 2004-2005 Yuichi SATO
25 .\"         all rights reserved.
26 .\" Translated Thu Aug 26 06:04:53 JST 2004
27 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
28 .\" Updated & Modified Sat Jan 15 06:38:41 JST 2005 by Yuichi SATO
29 .\"
30 .TH LOGIN 3 2004-05-06 "GNU" "Linux Programmer's Manual"
31 .\"O .SH NAME
32 .SH 名前
33 .\"O login, logout \- write utmp and wtmp entries
34 login, logout \- utmp と wtmp エントリを書き込む
35 .\"O .SH SYNOPSIS
36 .SH 書式
37 .B #include <utmp.h>
38 .sp
39 .BI "void login(const struct utmp *" ut );
40 .sp
41 .BI "int logout(const char *" ut_line );
42 .sp
43 .\"O Link with \fI\-lutil\fP.
44 \fI\-lutil\fP でリンクする。
45 .\"O .SH DESCRIPTION
46 .SH 説明
47 .\"O The utmp file records who is currently using the system.
48 utmp ファイルは現在システムを使用しているユーザを記録する。
49 .\"O The wtmp file records all logins and logouts.
50 .\"O See
51 .\"O .BR utmp (5).
52 wtmp ファイルはすべてのログインとログアウトを記録する。
53 .BR utmp (5)
54 を参照すること。
55 .LP
56 .\"O The function
57 .\"O .BR login ()
58 .\"O takes the supplied \fIstruct utmp\fP
59 .\"O .IR ut ,
60 .\"O and writes it to both the utmp and the wtmp file.
61 関数
62 .BR login ()
63 は与えられた \fIstruct utmp\fP
64 .I ut
65 を utmp と wtmp ファイルの両方に書き込む。
66 .LP
67 .\"O The function
68 .\"O .BR logout ()
69 .\"O clears the entry in the utmp file again.
70 関数
71 .BR logout ()
72 は utmp ファイルにあるエントリをクリアする。
73 .\"O .SS "GNU Details"
74 .SS "GNU 版の詳細"
75 .\"O More precisely,
76 .\"O .BR login ()
77 .\"O takes the argument
78 .\"O .I ut
79 .\"O struct, fills the field
80 .\"O .I ut\->ut_type
81 .\"O (if there is such a field) with the value
82 .\"O .BR USER_PROCESS ,
83 .\"O and fills the field
84 .\"O .I ut\->ut_pid
85 .\"O (if there is such a field) with the process ID of the calling process.
86 より正確には、
87 .BR login ()
88 は引き数
89 .I ut
90 構造体をとり、(もし存在するならば) フィールド
91 .I ut\->ut_type
92
93 .B USER_PROCESS
94 という値にし、(もし存在するならば) フィールド
95 .I ut\->ut_pid
96 を呼び出し元プロセスのプロセス ID の値にする。
97 .\"O Then it tries to fill the field
98 .\"O .IR ut\->ut_line .
99 次にフィールド
100 .I ut\->ut_line
101 の値を設定しようとする。
102 .\"O It takes the first of \fIstdin\fP, \fIstdout\fP, \fIstderr\fP
103 .\"O that is a tty, and
104 .\"O stores the corresponding pathname minus a possible leading \fI/dev/\fP
105 .\"O into this field, and then writes the struct to the utmp file.
106 この関数は、標準入力・標準出力・標準エラー出力の中から
107 端末 (tty) である最初のものをとり、
108 対応するパス名から先頭の \fI/dev/\fP を引いたものを
109 このフィールドに格納して、この構造体を utmp ファイルに書き込む。
110 .\"O On the other hand, if no tty name was found, this field is filled with "???"
111 .\"O and the struct is not written to the utmp file.
112 .\"O After this, the struct is written to the wtmp file.
113 一方、端末名が見つからない場合は、このフィールドは "???" とされて、
114 この構造体は utmp ファイルに書き込まれない。
115 その後にこの構造体は wtmp ファイルに書き込まれる。
116 .LP
117 .\"O The
118 .\"O .BR logout ()
119 .\"O function searches the utmp file for an entry matching the
120 .\"O .I ut_line
121 .\"O argument.
122 .\"O If a record is found, it is updated by zeroing out the
123 .\"O .I ut_name
124 .\"O and
125 .\"O .I ut_host
126 .\"O fields, updating the
127 .\"O .I ut_tv
128 .\"O timestamp field and setting
129 .\"O .I ut_type
130 .\"O (if there is such a field) to
131 .\"O .BR DEAD_PROCESS .
132 .BR logout ()
133 関数は utmp ファイルから
134 .I ut_line
135 引き数にマッチするエントリを探す。
136 レコードが見つかった場合、
137 .I ut_name
138
139 .I ut_host
140 フィールドをクリアして、
141 .I ut_tv
142 タイムスタンプフィールドを更新し、
143 (もし存在するならば)
144 .I ut_type
145 フィールドを
146 .B DEAD_PROCESS
147 に更新する。
148 .\"O .SH "RETURN VALUE"
149 .SH 返り値
150 .\"O The
151 .\"O .BR logout ()
152 .\"O function returns 1 if the entry was successfully written to the
153 .\"O database, or 0 if an error occurred.
154 エントリをデータベースに書き込むのに成功した場合、
155 .BR logout ()
156 関数は 1 を返す。
157 またエラーが起こった場合、0 を返す。
158 .\"O .SH FILES
159 .SH ファイル
160 .TP
161 .I /var/run/utmp
162 .\"O user accounting database, configured through
163 .\"O .B _PATH_UTMP
164 .\"O in
165 .\"O .I <paths.h>
166 ユーザアカウントデータベース。
167 .I <paths.h>
168 における
169 .B _PATH_UTMP
170 で設定されている。
171 .TP
172 .I /var/log/wtmp
173 .\"O user accounting log file, configured through
174 .\"O .B _PATH_WTMP
175 .\"O in
176 .\"O .I <paths.h>
177 ユーザアカウントログファイル。
178 .I <paths.h>
179 における
180 .B _PATH_WTMP
181 で設定されている。
182 .\"O .SH "CONFORMING TO"
183 .SH 準拠
184 .\"O Not in POSIX.1-2001.
185 .\"O Present on the BSDs.
186 POSIX.1-2001 にはない。
187 BSD 系に存在する。
188 .\"O .SH NOTES
189 .SH 注意
190 .\"O Note that the
191 .\"O member
192 .\"O .I ut_user
193 .\"O of
194 .\"O .I struct utmp
195 .\"O is called
196 .\"O .I ut_name
197 .\"O in BSD.
198 .\"O Therefore,
199 .\"O .I ut_name
200 .\"O is defined as an alias for
201 .\"O .I ut_user
202 .\"O in
203 .\"O .IR <utmp.h> .
204 .I struct utmp
205 のメンバ
206 .I ut_user
207 は、BSD では
208 .I ut_name
209 という名前である点に注意すること。
210 そのため
211 .I ut_name
212
213 .I <utmp.h>
214 において
215 .I ut_user
216 のエイリアスとして定義されている。
217 .\"O .SH "SEE ALSO"
218 .SH 関連項目
219 .BR getutent (3),
220 .BR utmp (5)