utmp(4) DG/UX R4.11MU05 utmp(4)
NAME
utmp, wtmp, utmpx, wtmpx - user and accounting information
SYNOPSIS
utmp
#include <utmp.h>
utmpx
#include <utmpx.h>
DESCRIPTION
These files, which hold user and accounting information for such
commands as who(1), write(1), and login(1), have the following
structure as defined by <utmp.h> and <utmpx.h>:
<utmp.h>
#define UTMPFILE "/var/adm/utmp"
#define WTMPFILE "/var/adm/wtmp"
The <utmp.h> header defines the utmp structure which
includes at least the following members:
struct utmp {
char utuser[]; /* User login name */
char utid[]; /* /etc/inittab id (usually line #) */
char utline[]; /* device name (console, lnxx) */
short utpid; /* process id */
short uttype; /* type of entry */
struct exitstatus {
short etermination; /* Process termination status */
short eexit; /* Process exit status */
} utexit; /* The exit status of a process
/* marked as DEADPROCESS. */
timet uttime; /* time entry was made */
char uthost[]; /* hostname, if remote */
};
<utmpx.h>
#define UTMPXFILE "/var/adm/utmpx"
#define WTMPXFILE "/var/adm/wtmpx"
The <utmpx.h> header defines the utmpx structure which
includes the same members as defined above for struct utmp,
except for uttime. In addition, struct utmpx includes at
least the following members:
struct utmpx {
struct timeval uttv; /* Time entry was made */
long utsession; /* Session ID, used for windowing */
short utsyslen; /* The significant length of uthost */
}
Both <utmp.h> and <utmpx.h>
/* The following symbolic constants are defined as possible */
/* values for the uttype member of the utmp and utmpx structures: */
#define EMPTY 0 /* No valid user accounting information */
#define RUNLVL 1 /* A run level change */
#define BOOTTIME 2 /* Time of system boot */
#define OLDTIME 3 /* Time when system clock changed */
#define NEWTIME 4 /* Time after system clock changed */
#define INITPROCESS 5 /* A process spawned by "init" */
#define LOGINPROCESS 6 /* Session leader of a logged in user*/
#define USERPROCESS 7 /* A user process */
#define DEADPROCESS 8 /* A session leader who has exited */
#define ACCOUNTING 9
#define FTP 128
#define REMOTELOGIN 129
#define REMOTEPROCESS 130
#define UTMAXTYPE 130 /* Largest legal value of uttype */
/* Special strings or formats used in the utline field when */
/* accounting for something other than a process */
/* No string for the utline field can be more than 11 chars + */
/* a NULL in length */
#define RUNLVLMSG "run-level %c"
#define BOOTMSG "system boot"
#define OTIMEMSG "old time"
#define NTIMEMSG "new time"
FILES
/usr/include/utmp.h /usr/include/utmpx.h
/var/adm/utmp /var/adm/utmpx
/var/adm/wtmp /var/adm/wtmpx
SEE ALSO
login(1), who(1), write(1), getut(3C), getutx(3C), limits(4).
NOTES
The getut interfaces, which manipulate the utmp file, and the getutx
interfaces, which manipulate the utmpx file, are available on both
DG/UX for 88K and DG/UX for Intel. However, the utmp file is present
only on DG/UX for 88K, and the utmpx file is present only on DG/UX
for Intel. In cases where an interface for a particular file is used
on a platform that does not have that file, then the interfaces all
perform data conversion and use the file format of the host platform.
You should use the getutx interfaces for applications on both
platforms, since the utmpx structure provides the most information.
It is also important to note that the sizes of some fields in the
structures are different on the different platforms. Whenever
possible, use programming techniques that do not rely on hard-coded
sizes. For example, instead of:
struct utmpx utmpx;
strncpy(utmpx.ut_user, "myname", 8);
use:
struct utmpx utmpx;
strncpy(utmpx.ut_user, "myname", sizeof(utmpx.ut_user));
Licensed material--property of copyright holder(s)