Provide a little more detail on fields of utmp structure.

This commit is contained in:
Michael Kerrisk 2008-06-29 04:43:41 +00:00
parent ff6953dcb9
commit 45ec232d31
1 changed files with 23 additions and 18 deletions

View File

@ -74,31 +74,36 @@ struct exit_status {
}; };
struct utmp { struct utmp {
short ut_type; /* type of login */ short ut_type; /* Type of record */
pid_t ut_pid; /* PID of login process */ pid_t ut_pid; /* PID of login process */
char ut_line[UT_LINESIZE]; /* device name of tty \- "/dev/" */ char ut_line[UT_LINESIZE]; /* device name of tty \- "/dev/" */
char ut_id[4]; /* init id or abbrev. ttyname */ char ut_id[4]; /* Terminal name suffix,
char ut_user[UT_NAMESIZE]; /* user name */ or inittab(5) ID */
char ut_host[UT_HOSTSIZE]; /* hostname for remote login */ char ut_user[UT_NAMESIZE]; /* username */
struct exit_status ut_exit; /* The exit status of a process char ut_host[UT_HOSTSIZE]; /* Hostname for remote login, or
marked as DEAD_PROCESS */ kernel version for run-level
messages */
struct exit_status ut_exit; /* Exit status of a process
marked as DEAD_PROCESS; not
used by Linux init(8) */
/* The ut_session and ut_tv fields must be the same size when /* The ut_session and ut_tv fields must be the same size when
compiled 32- and 64-bit. This allows data files and shared compiled 32- and 64-bit. This allows data files and shared
memory to be shared between 32- and 64-bit applications */ memory to be shared between 32- and 64-bit applications. */
#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
int32_t ut_session; /* Session ID, used for windowing */ int32_t ut_session; /* Session ID, used for windowing */
struct { struct {
int32_t tv_sec; /* Seconds */ int32_t tv_sec; /* Seconds */
int32_t tv_usec; /* Microseconds */ int32_t tv_usec; /* Microseconds */
} ut_tv; /* Time entry was made */ } ut_tv; /* Time entry was made */
#else #else
long int ut_session; /* Session ID, used for windowing */ long ut_session; /* Session ID, used for windowing */
struct timeval ut_tv; /* Time entry was made */ struct timeval ut_tv; /* Time entry was made */
#endif #endif
int32_t ut_addr_v6[4]; /* IP address of remote host */ int32_t ut_addr_v6[4]; /* Internet address of remote
char __unused[20]; /* Reserved for future use */ host; IPv4 address uses
just ut_addr_v6[0] */
char __unused[20]; /* Reserved for future use */
}; };
/* Backwards compatibility hacks. */ /* Backwards compatibility hacks. */