1LOGIN(3)                   Linux Programmer's Manual                  LOGIN(3)
2
3
4

NAME

6       login, logout - write utmp and wtmp entries
7

SYNOPSIS

9       #include <utmp.h>
10
11       void login(const struct utmp *ut);
12
13       int logout(const char *ut_line);
14
15       Link with -lutil.
16

DESCRIPTION

18       The utmp file records who is currently using the system.  The wtmp file
19       records all logins and logouts.  See utmp(5).
20
21       The function login() takes the supplied struct utmp, ut, and writes  it
22       to both the utmp and the wtmp file.
23
24       The function logout() clears the entry in the utmp file again.
25
26   GNU details
27       More  precisely,  login() takes the argument ut struct, fills the field
28       ut->ut_type (if there is such a field) with the value USER_PROCESS, and
29       fills  the field ut->ut_pid (if there is such a field) with the process
30       ID  of  the  calling  process.   Then  it  tries  to  fill  the   field
31       ut->ut_line.   It  takes  the  first of stdin, stdout, stderr that is a
32       terminal, and stores the corresponding pathname minus a possible  lead‐
33       ing /dev/ into this field, and then writes the struct to the utmp file.
34       On the other hand, if no terminal name was found, this field is  filled
35       with  "???"   and  the  struct  is not written to the utmp file.  After
36       this, the struct is written to the wtmp file.
37
38       The logout() function searches the utmp file for an entry matching  the
39       ut_line  argument.   If a record is found, it is updated by zeroing out
40       the ut_name and ut_host fields, updating the ut_tv timestamp field  and
41       setting ut_type (if there is such a field) to DEAD_PROCESS.
42

RETURN VALUE

44       The  logout()  function returns 1 if the entry was successfully written
45       to the database, or 0 if an error occurred.
46

FILES

48       /var/run/utmp
49              user  accounting  database,  configured  through  _PATH_UTMP  in
50              <paths.h>
51
52       /var/log/wtmp
53              user  accounting  log  file,  configured  through  _PATH_WTMP in
54              <paths.h>
55

CONFORMING TO

57       Not in POSIX.1-2001.  Present on the BSDs.
58

NOTES

60       Note that the member ut_user of struct utmp is called ut_name  in  BSD.
61       Therefore, ut_name is defined as an alias for ut_user in <utmp.h>.
62

SEE ALSO

64       getutent(3), utmp(5)
65

COLOPHON

67       This  page  is  part of release 3.53 of the Linux man-pages project.  A
68       description of the project, and information about reporting  bugs,  can
69       be found at http://www.kernel.org/doc/man-pages/.
70
71
72
73GNU                               2004-05-06                          LOGIN(3)
Impressum