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 2021-03-22 "GNU" "Linux Programmer's Manual"
27 login, logout \- write utmp and wtmp entries
32 .BI "void login(const struct utmp *" ut );
33 .BI "int logout(const char *" ut_line );
36 Link with \fI\-lutil\fP.
38 The utmp file records who is currently using the system.
39 The wtmp file records all logins and logouts.
48 and writes it to both the utmp and the wtmp file.
52 clears the entry in the utmp file again.
58 struct, fills the field
60 (if there is such a field) with the value
64 (if there is such a field) with the process ID of the calling process.
65 Then it tries to fill the field
71 that is a terminal, and
72 stores the corresponding pathname minus a possible leading
74 into this field, and then writes the struct to the utmp file.
76 if no terminal name was found, this field is filled with "???"
77 and the struct is not written to the utmp file.
78 After this, the struct is written to the wtmp file.
82 function searches the utmp file for an entry matching the
85 If a record is found, it is updated by zeroing out the
91 timestamp field and setting
93 (if there is such a field) to
98 function returns 1 if the entry was successfully written to the
99 database, or 0 if an error occurred.
103 user accounting database, configured through
109 user accounting log file, configured through
114 For an explanation of the terms used in this section, see
122 Interface Attribute Value
138 signifies that if any of the functions
143 are used in parallel in different threads of a program,
144 then data races could occur.
148 calls those functions,
149 so we use race:utent to remind users.
164 is defined as an alias for