utmp(4)
NAME
utmp, wtmp − utmp and wtmp entry formats
SYNOPSIS
#include <sys/types.h>
#include <utmp.h>
DESCRIPTION
These files, which hold user and accounting information for such commands as who(1), write(1), and login(1), are an array of utmp structures with the following members:
#defineut_nameut_user
char ut_user[8];/∗ User login name ∗/
char ut_id[4]; /∗ /etc/inittab id (usually line #) ∗/
char ut_line[12];/∗ device name (console, lnxx) ∗/
pid_t ut_pid; /∗ process id ∗/
short ut_type; /∗ type of entry ∗/
struct exit_status {
short e_termination;/∗ Process termination status ∗/
short e_exit;/∗ Process exit status ∗/
} ut_exit; /∗ The exit status of a process
marked as DEAD_PROCESS. ∗/
time_t ut_time; /∗ time entry was made ∗/
char ut_host[16];/∗ host name, if remote ∗/
The definitions for ut_type are:
EMPTY
RUN_LVL
BOOT_TIME
OLD_TIME
NEW_TIME
INIT_PROCESS/∗ Process spawned by "init" ∗/
LOGIN_PROCESS/∗ A "getty" process waiting for login ∗/
USER_PROCESS/∗ A user process ∗/
DEAD_PROCESS
ACCOUNTING
Special strings or formats used in the ut_line field when accounting for something other than a process No string for the ut_line field can be more than 11 chars + NULL in length
#defineRUNLVL_MSG "run−level %c"
#defineBOOT_MSG "system boot"
#defineOTIME_MSG "old time"
#defineNTIME_MSG "new time"
NOTES
The structure documented above is the AT&T SYSV.2 version of utmp with one additional field, ut_host, borrowed from 4.2BSD. The ut_host field, as it is not compatible with several standards, should not be used. The 4.2BSD version of utmp is a subset of the one above.
The most significant difference between the 4.2BSD and SYSV.2 structures is the ut_type field. A 4.2BSD system distinguishes among the different types of records (login, logout, reboot, change of system time, etc.) in the wtmp file with values in ut_name. A SYSV.2 system uses ut_type for that purpose.
| Record | 4.2BSD | SYSV.2 |
| ut_name | ut_type | |
| logout | null | DEAD_PROCESS |
| reboot | ’~’ | BOOT_TIME |
| old date | ’|’ | OLD_TIME |
| new date | ’}’ | NEW_TIME |
FILES
/usr/include/utmp.h
/etc/utmp
/etc/wtmp
SEE ALSO
getut(3C).
login(1), who(1), write(1) in the CX/UX User’s Reference Manual.
CX/UX Programmer’s Reference Manual