]> git.saurik.com Git - apple/libc.git/blame - man/utmp.5
Libc-763.13.tar.gz
[apple/libc.git] / man / utmp.5
CommitLineData
b5d655f7
A
1.\" $NetBSD: utmp.5,v 1.5 1994/11/30 19:31:35 jtc Exp $
2.\"
3.\" Copyright (c) 1980, 1991, 1993
4.\" The Regents of the University of California. All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\" must display the following acknowledgement:
16.\" This product includes software developed by the University of
17.\" California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\" may be used to endorse or promote products derived from this software
20.\" without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\" @(#)utmp.5 8.2 (Berkeley) 3/17/94
35.\"
36.Dd March 17, 1994
37.Dt UTMP 5
38.Os BSD 4
39.Sh NAME
40.Nm utmp ,
41.Nm wtmp ,
42.Nm lastlog
43.Nd login records (DEPRECATED)
44.Sh SYNOPSIS
45.Fd #include <utmp.h>
46.Sh DESCRIPTION
47The interfaces in file
48.Aq Pa utmp.h
49are all
5f4d86c1 50.Sy DEPRECATED
b5d655f7
A
51and are only provided for compatibility with previous releases of Mac OS X.
52See
53.Xr pututxline 3
54and
55.Xr utmpx 5
56for the supported interfaces.
57.Pp
58.Aq Pa utmp.h
59declares the structures used to record information about current
60users in the file
61.Nm utmp ,
62logins and logouts in the file
63.Nm wtmp ,
64and last logins in the file
65.Nm lastlog .
66The time stamps of date changes, shutdowns and reboots are also logged in
67the
68.Nm wtmp
69file.
70.Pp
71These files can grow rapidly on busy systems, daily or weekly rotation
72is recommended.
73If any of these files do not exist, it is not created.
74These
75files must be created manually and are normally maintained in either the script
76.Pa /etc/daily
77or the script
78.Pa /etc/weekly .
79(See
80.Xr cron 8 . )
81.Bd -literal -offset indent
82#define _PATH_UTMP "/var/run/utmp"
83#define _PATH_WTMP "/var/log/wtmp"
84#define _PATH_LASTLOG "/var/log/lastlog"
85
86#define UT_NAMESIZE 8
87#define UT_LINESIZE 8
88#define UT_HOSTSIZE 16
89
90struct lastlog {
91 time_t ll_time;
92 char ll_line[UT_LINESIZE];
93 char ll_host[UT_HOSTSIZE];
94};
95
96struct utmp {
97 char ut_line[UT_LINESIZE];
98 char ut_name[UT_NAMESIZE];
99 char ut_host[UT_HOSTSIZE];
100 time_t ut_time;
101};
102.Ed
103.Pp
104Each time a user logs in, the
105.Xr login
106program looks up the user's
107.Tn UID
108in the file
109.Nm lastlog.
110If it is found, the timestamp of the last time the user logged
111in, the terminal line and the hostname
112are written to the standard output. (Providing the login is not
113.Em quiet ,
114see
115.Xr login 1 . )
116The
117.Xr login
118program then records the new login time in the file
119.Nm lastlog .
120.Pp
121After the new
122.Fa lastlog
123record is written ,
124.\" the
125.\" .Xr libutil 3
126.\" routine
127the file
128.Nm utmp
129is opened and the
130.Fa utmp
131record for the user inserted.
132This record remains there until
133the user logs out at which time it is deleted.
134The
135.Nm utmp
136file is used by the programs
137.Xr rwho 1 ,
138.Xr users 1 ,
139.Xr w 1 ,
140and
141.Xr who 1 .
142.Pp
143Next, the
144.Xr login
145program opens the file
146.Nm wtmp ,
147and appends the user's
148.Fa utmp
149record.
150The same
151.Fa utmp
152record, with an updated time stamp is later appended
153to the file when the user logs out. (See
154.Xr launchd 8 . )
155The
156.Nm wtmp
157file is used by the programs
158.Xr last 1
159and
160.Xr ac 8 .
161.Pp
162In the event of a date change, a shutdown or reboot, the
163following items are logged in the
164.Nm wtmp
165file.
166.Pp
167.Bl -tag -width shutdownxx -compact
168.It Li reboot
169.It Li shutdown
170A system reboot or shutdown has been initiated.
171The character
172.Ql \&~
173is placed in the field
174.Fa ut_line ,
175and
176.Li reboot
177or
178.Li shutdown
179in the field
180.Fa ut_name .
181(See
182.Xr shutdown 8
183and
184.Xr reboot 8 . )
185.Pp
186.It Li date
187The system time has been manually or automatically updated.
188(See
189.Xr date 1 . )
190The command name
191.Xr date
192is recorded in the field
193.Fa ut_name .
194In the field
195.Fa ut_line ,
196the character
197.Ql \\*(Ba
198indicates the time prior to the change, and the character
199.Ql \&{
200indicates the new time.
201.El
202.Sh FILES
203.Bf Sy
204(These files no longer exist in 10.5 or later.)
205.Ef
206.Pp
207.Bl -tag -width /var/log/lastlog -compact
208.It Pa /var/run/utmp
209The
210.Nm utmp file.
211.It Pa /var/log/wtmp
212The
213.Nm wtmp file.
214.It Pa /var/log/lastlog
215The
216.Nm lastlog file.
217.El
218.Sh SEE ALSO
219.Xr last 1 ,
220.Xr login 1 ,
221.Xr who 1 ,
222.Xr ac 8 ,
223.Xr launchd 8
224.Sh HISTORY
225A
226.Nm utmp
227and
228.Nm wtmp
229file format appeared in
230.At v6 .
231The
232.Nm lastlog
233file format appeared in
234.Bx 3.0 .