NetBSD/share/man/man5/utmpx.5
wiz 4a47c952db Add documentation for utmpx and some related functions.
Thanks for some explanations to christos, and for some STANDARDS hints
to Klaus Klein.
2002-09-27 15:02:24 +00:00

138 lines
3.8 KiB
Groff

.\" $NetBSD: utmpx.5,v 1.1 2002/09/27 15:02:26 wiz Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Thomas Klausner.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 26, 2002
.Dt UTMPX 5
.Os
.Sh NAME
.Nm utmpx ,
.Nm wtmpx ,
.Nm lastlogx
.Nd user accounting database
.Sh SYNOPSIS
.Fd #include \*[Lt]utmpx.h\*[Gt]
.Sh DESCRIPTION
The
.Aq Pa utmpx.h
header defines the structures and functions for logging user.
Currently logged in users are tracked in
.Pa /var/run/utmpx ,
a list of all logins and logouts, as well as all shutdowns, reboots
and date changes, is kept in
.Pa /var/log/wtmpx ,
and the last login of each user is noted in
.Pa /var/log/lastlogx .
The files are not automatically created if they do not exist; they
must be created manually.
.Pp
The interface to the
.Nm utmpx
file is described in
.Xr endutxent 3 .
.Pp
The
.Nm wtmpx
file can grow rapidly on busy systems, and is normally rotated with
.Xr newsyslog 8 .
.Pp
In the event of a date change, a shutdown, or a reboot, the following
items are logged in the
.Nm wtmpx
file:
.Bl -tag -width shutdownxx -compact -offset indent
.It Li date
The system time has been manually or automatically updated by
.Xr date 1 .
The command name
.Em date
is recorded in the field
.Fa ut_name .
In the field
.Fa ut_line ,
the character
.Ql \\*(Ba
indicates the time prior to the change, and the character
.Ql \&{
indicates the new time.
.It Li reboot
.It Li shutdown
A system reboot or shutdown has been initiated.
The character
.Ql \&~
is placed in the field
.Fa ut_line ,
and
.Li reboot
or
.Li shutdown
in the field
.Fa ut_name
(see
.Xr shutdown 8
and
.Xr reboot 8 ) ,
using
.Xr logwtmpx 3 .
.Pp
.El
.Sh FILES
.Bl -tag -width /var/log/lastlogx -compact
.It Pa /var/run/utmpx
The
.Nm utmpx
file.
.It Pa /var/log/wtmpx
The
.Nm wtmpx
file.
.It Pa /var/log/lastlogx
The
.Nm lastlogx
file.
.El
.Sh SEE ALSO
.Xr last 1 ,
.Xr login 1 ,
.Xr rwho 1 ,
.Xr w 1 ,
.Xr who 1 ,
.Xr endutxent 3 ,
.Xr logwtmpx 3 ,
.Xr ac 8 ,
.Xr init 8 ,
.Xr newsyslog 8 ,
.Xr reboot 8