1 .\" Derived from text written by Martin Schulze (or taken from glibc.info)
2 .\" and text written by Paul Thompson - both copyright 2002.
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
25 .TH LOGIN 3 2004-05-06 "GNU" "Linux Programmer's Manual"
27 login, logout \- write utmp and wtmp entries
31 .BI "void login(const struct utmp *" ut );
33 .BI "int logout(const char *" ut_line );
35 Link with \fI\-lutil\fP.
37 The utmp file records who is currently using the system.
38 The wtmp file records all logins and logouts.
44 takes the supplied \fIstruct utmp\fP,
46 and writes it to both the utmp and the wtmp file.
50 clears the entry in the utmp file again.
56 struct, fills the field
58 (if there is such a field) with the value
62 (if there is such a field) with the process ID of the calling process.
63 Then it tries to fill the field
65 It takes the first of \fIstdin\fP, \fIstdout\fP, \fIstderr\fP
66 that is a terminal, and
67 stores the corresponding pathname minus a possible leading \fI/dev/\fP
68 into this field, and then writes the struct to the utmp file.
69 On the other hand, if no terminal name was found, this field is filled with "???"
70 and the struct is not written to the utmp file.
71 After this, the struct is written to the wtmp file.
75 function searches the utmp file for an entry matching the
78 If a record is found, it is updated by zeroing out the
84 timestamp field and setting
86 (if there is such a field) to
91 function returns 1 if the entry was successfully written to the
92 database, or 0 if an error occurred.
96 user accounting database, configured through
102 user accounting log file, configured through
120 is defined as an alias for