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.
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.
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.
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,
21 .\" Derived from text written by Martin Schulze (or taken from glibc.info)
22 .\" and text written by Paul Thompson - both copyright 2002.
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
30 .TH LOGIN 3 2004-05-06 "GNU" "Linux Programmer's Manual"
33 .\"O login, logout \- write utmp and wtmp entries
34 login, logout \- utmp ¤È wtmp ¥¨¥ó¥È¥ê¤ò½ñ¤¹þ¤à
39 .BI "void login(const struct utmp *" ut );
41 .BI "int logout(const char *" ut_line );
43 .\"O Link with \fI\-lutil\fP.
44 \fI\-lutil\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
47 .\"O The utmp file records who is currently using the system.
48 utmp ¥Õ¥¡¥¤¥ë¤Ï¸½ºß¥·¥¹¥Æ¥à¤ò»ÈÍѤ·¤Æ¤¤¤ë¥æ¡¼¥¶¤òµÏ¿¤¹¤ë¡£
49 .\"O The wtmp file records all logins and logouts.
52 wtmp ¥Õ¥¡¥¤¥ë¤Ï¤¹¤Ù¤Æ¤Î¥í¥°¥¤¥ó¤È¥í¥°¥¢¥¦¥È¤òµÏ¿¤¹¤ë¡£
58 .\"O takes the supplied \fIstruct utmp\fP
60 .\"O and writes it to both the utmp and the wtmp file.
63 ¤ÏÍ¿¤¨¤é¤ì¤¿ \fIstruct utmp\fP
65 ¤ò utmp ¤È wtmp ¥Õ¥¡¥¤¥ë¤ÎξÊý¤Ë½ñ¤¹þ¤à¡£
69 .\"O clears the entry in the utmp file again.
72 ¤Ï utmp ¥Õ¥¡¥¤¥ë¤Ë¤¢¤ë¥¨¥ó¥È¥ê¤ò¥¯¥ê¥¢¤¹¤ë¡£
73 .\"O .SS "GNU Details"
77 .\"O takes the argument
79 .\"O struct, fills the field
81 .\"O (if there is such a field) with the value
82 .\"O .BR USER_PROCESS ,
83 .\"O and fills the field
85 .\"O (if there is such a field) with the process ID of the calling process.
90 ¹½Â¤ÂΤò¤È¤ê¡¢(¤â¤·Â¸ºß¤¹¤ë¤Ê¤é¤Ð) ¥Õ¥£¡¼¥ë¥É
94 ¤È¤¤¤¦Ãͤˤ·¡¢(¤â¤·Â¸ºß¤¹¤ë¤Ê¤é¤Ð) ¥Õ¥£¡¼¥ë¥É
96 ¤ò¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤ÎÃͤˤ¹¤ë¡£
97 .\"O Then it tries to fill the field
98 .\"O .IR 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 ¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤Þ¤ì¤ë¡£
119 .\"O function searches the utmp file for an entry matching the
122 .\"O If a record is found, it is updated by zeroing out the
126 .\"O fields, updating the
128 .\"O timestamp field and setting
130 .\"O (if there is such a field) to
131 .\"O .BR DEAD_PROCESS .
133 ´Ø¿ô¤Ï utmp ¥Õ¥¡¥¤¥ë¤«¤é
135 °ú¤¿ô¤Ë¥Þ¥Ã¥Á¤¹¤ë¥¨¥ó¥È¥ê¤òõ¤¹¡£
136 ¥ì¥³¡¼¥É¤¬¸«¤Ä¤«¤Ã¤¿¾ì¹ç¡¢
140 ¥Õ¥£¡¼¥ë¥É¤ò¥¯¥ê¥¢¤·¤Æ¡¢
142 ¥¿¥¤¥à¥¹¥¿¥ó¥×¥Õ¥£¡¼¥ë¥É¤ò¹¹¿·¤·¡¢
148 .\"O .SH "RETURN VALUE"
152 .\"O function returns 1 if the entry was successfully written to the
153 .\"O database, or 0 if an error occurred.
154 ¥¨¥ó¥È¥ê¤ò¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë½ñ¤¹þ¤à¤Î¤ËÀ®¸ù¤·¤¿¾ì¹ç¡¢
157 ¤Þ¤¿¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¾ì¹ç¡¢0 ¤òÊÖ¤¹¡£
162 .\"O user accounting database, configured through
166 ¥æ¡¼¥¶¥¢¥«¥¦¥ó¥È¥Ç¡¼¥¿¥Ù¡¼¥¹¡£
173 .\"O user accounting log file, configured through
177 ¥æ¡¼¥¶¥¢¥«¥¦¥ó¥È¥í¥°¥Õ¥¡¥¤¥ë¡£
182 .\"O .SH "CONFORMING TO"
184 .\"O Not in POSIX.1-2001.
185 .\"O Present on the BSDs.
186 POSIX.1-2001 ¤Ë¤Ï¤Ê¤¤¡£
200 .\"O is defined as an alias for
209 ¤È¤¤¤¦Ì¾Á°¤Ç¤¢¤ëÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
216 ¤Î¥¨¥¤¥ê¥¢¥¹¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£