820 Chapter 40
The ut_type field is an integer defining the type of record being written to the
file. The following set of constants (with their corresponding numeric values shown
in parentheses) can be used as values for this field:
EMPTY (0)
This record doesn’t contain valid accounting information.
RUN_LVL (1)
This record indicates a change in the system’s run-level during system star-
tup or shutdown. (Information about run-levels can be found in the init(8)
manual page.) The _GNU_SOURCE feature test macro must be defined in order
to obtain the definition of this constant from <utmpx.h>.
BOOT_TIME (2)
This record contains the time of system boot in the ut_tv field. The usual
author of RUN_LVL and BOOT_TIME records is init. These records are written to
both the utmp file and the wtmp file.
NEW_TIME (3)
This record contains the new time after a system clock change, recorded in
the ut_tv field.
OLD_TIME (4)
This record contains the old time before a system clock change, recorded
in the ut_tv field. Records of type OLD_TIME and NEW_TIME are written to the
utmp and wtmp files by the NTP (or a similar) daemon when it makes changes
to the system clock.
INIT_PROCESS (5)
This is a record for a process spawned by init, such as a getty process. Refer
to the inittab(5) manual page for details.
LOGIN_PROCESS (6)
This is a record for a session leader process for a user login, such as a
login(1) process.
USER_PROCESS (7)
This is a record for a user process, usually a login session, with the user-
name appearing in the ut_user field. The login session may have been
started by login(1) or by some application offering a remote login facility,
such as ftp or ssh.
DEAD_PROCESS (8)
This record identifies a process that has exited.
We show the numeric values of these constants because various applications
depend on the constants having the above numerical order. For example, in the
source code of the agetty program, we find checks such as the following:
utp->ut_type >= INIT_PROCESS && utp->ut_type <= DEAD_PROCESS
Records of the type INIT_PROCESS usually correspond to invocations of getty(8) (or a
similar program, such as agetty(8) or mingetty(8)). On system boot, the init process