OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[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)