1UTMP(5)                       File Formats Manual                      UTMP(5)
2
3
4

NAME

6       utmp, wtmp - login records
7

SYNOPSIS

9       #include <utmp.h>
10

DESCRIPTION

12       The utmp file records information about who is currently using the sys‐
13       tem.  The file is a sequence of entries with  the  following  structure
14       declared in the include file:
15
16              /* Copyright (C) 1993, 1996-1999, 2012 Free Software Foundation, Inc.
17                 This file is part of the GNU C Library.
18
19                 The GNU C Library is free software; you can redistribute it and/or
20                 modify it under the terms of the GNU Lesser General Public
21                 License as published by the Free Software Foundation; either
22                 version 2.1 of the License, or (at your option) any later version.
23
24                 The GNU C Library is distributed in the hope that it will be useful,
25                 but WITHOUT ANY WARRANTY; without even the implied warranty of
26                 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27                 Lesser General Public License for more details.
28
29                 You should have received a copy of the GNU Lesser General Public
30                 License along with the GNU C Library; if not, see
31                 <http://www.gnu.org/licenses/>.  */
32
33              #ifndef   _UTMP_H
34              #define   _UTMP_H   1
35
36              #include <features.h>
37
38              #include <sys/types.h>
39
40
41              __BEGIN_DECLS
42
43              /* Get system dependent values and data structures.  */
44              #include <bits/utmp.h>
45
46              /* Compatibility names for the strings of the canonical file names.  */
47              #define UTMP_FILE   _PATH_UTMP
48              #define UTMP_FILENAME    _PATH_UTMP
49              #define WTMP_FILE   _PATH_WTMP
50              #define WTMP_FILENAME    _PATH_WTMP
51
52
53
54              /* Make FD be the controlling terminal, stdin, stdout, and stderr;
55                 then close FD.  Returns 0 on success, nonzero on error.  */
56              extern int login_tty (int __fd) __THROW;
57
58
59              /* Write the given entry into utmp and wtmp.  */
60              extern void login (const struct utmp *__entry) __THROW;
61
62              /* Write the utmp entry to say the user on UT_LINE has logged out.  */
63              extern int logout (const char *__ut_line) __THROW;
64
65              /* Append to wtmp an entry for the current time and the given info.  */
66              extern void logwtmp (const char *__ut_line, const char *__ut_name,
67                             const char *__ut_host) __THROW;
68
69              /* Append entry UTMP to the wtmp-like file WTMP_FILE.  */
70              extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
71                   __THROW;
72
73              /* Change name of the utmp file to be examined.  */
74              extern int utmpname (const char *__file) __THROW;
75
76              /* Read next entry from a utmp-like file.  */
77              extern struct utmp *getutent (void) __THROW;
78
79              /* Reset the input stream to the beginning of the file.  */
80              extern void setutent (void) __THROW;
81
82              /* Close the current open file.  */
83              extern void endutent (void) __THROW;
84
85              /* Search forward from the current point in the utmp file until the
86                 next entry with a ut_type matching ID->ut_type.  */
87              extern struct utmp *getutid (const struct utmp *__id) __THROW;
88
89              /* Search forward from the current point in the utmp file until the
90                 next entry with a ut_line matching LINE->ut_line.  */
91              extern struct utmp *getutline (const struct utmp *__line) __THROW;
92
93              /* Write out entry pointed to by UTMP_PTR into the utmp file.  */
94              extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
95
96
97              #ifdef    __USE_MISC
98              /* Reentrant versions of the file for handling utmp files.  */
99              extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
100
101              extern int getutid_r (const struct utmp *__id, struct utmp *__buffer,
102                              struct utmp **__result) __THROW;
103
104              extern int getutline_r (const struct utmp *__line,
105                             struct utmp *__buffer, struct utmp **__result) __THROW;
106
107              #endif    /* Use misc.  */
108
109              __END_DECLS
110
111              #endif /* utmp.h  */
112
113       This  structure  gives the name of the special file associated with the
114       user's terminal, the user's login name, and the time of  the  login  in
115       the form of time(3C).
116
117       The  wtmp  file records all logins and logouts.  A null user name indi‐
118       cates a logout on the associated terminal.  Furthermore,  the  terminal
119       name  `~' indicates that the system was rebooted at the indicated time;
120       the adjacent pair of entries with terminal names `|' and  `{'  indicate
121       the  system-maintained  time  just before and just after a date command
122       has changed the system's idea of the time.
123
124       Wtmp is maintained by login(1) and init(8).  Neither of these  programs
125       creates the file, so if it is removed record-keeping is turned off.  It
126       is summarized by ac(8).
127

FILES

129       /var/run/utmp
130       /usr/adm/wtmp
131

SEE ALSO

133       login(1), init(8), who(1), ac(8)
134
135
136
1374th Berkeley Distribution      November 27, 1996                       UTMP(5)
Impressum