Added text on biarch details for ut_session and ut_tv

This commit is contained in:
Michael Kerrisk 2005-09-15 13:36:44 +00:00
parent e3535a4396
commit f39e2bca7f
1 changed files with 68 additions and 27 deletions

View File

@ -52,39 +52,53 @@ around; details depend on the version of libc):
.nf
.sp
.ta 3i
#define UT_UNKNOWN 0
#define RUN_LVL 1
#define BOOT_TIME 2
#define NEW_TIME 3
#define OLD_TIME 4
#define INIT_PROCESS 5
#define LOGIN_PROCESS 6
#define USER_PROCESS 7
#define DEAD_PROCESS 8
#define ACCOUNTING 9
#define UT_UNKNOWN 0
#define RUN_LVL 1
#define BOOT_TIME 2
#define NEW_TIME 3
#define OLD_TIME 4
#define INIT_PROCESS 5
#define LOGIN_PROCESS 6
#define USER_PROCESS 7
#define DEAD_PROCESS 8
#define ACCOUNTING 9
#define UT_LINESIZE 12
#define UT_NAMESIZE 32
#define UT_HOSTSIZE 256
#define UT_LINESIZE 12
#define UT_NAMESIZE 32
#define UT_HOSTSIZE 256
struct exit_status {
short int e_termination; /* process termination status. */
short int e_exit; /* process exit status. */
short int e_termination; /* process termination status */
short int e_exit; /* process exit status */
};
struct utmp {
short ut_type; /* type of login */
pid_t ut_pid; /* PID of login process */
char ut_line[UT_LINESIZE]; /* device name of tty \- "/dev/" */
char ut_id[4]; /* init id or abbrev. ttyname */
char ut_user[UT_NAMESIZE]; /* user name */
char ut_host[UT_HOSTSIZE]; /* hostname for remote login */
struct exit_status ut_exit; /* The exit status of a process
marked as DEAD_PROCESS. */
long ut_session; /* session ID, used for windowing*/
struct timeval ut_tv; /* time entry was made. */
int32_t ut_addr_v6[4]; /* IP address of remote host. */
char __unused[20]; /* Reserved for future use. */
short ut_type; /* type of login */
pid_t ut_pid; /* PID of login process */
char ut_line[UT_LINESIZE]; /* device name of tty \- "/dev/" */
char ut_id[4]; /* init id or abbrev. ttyname */
char ut_user[UT_NAMESIZE]; /* user name */
char ut_host[UT_HOSTSIZE]; /* hostname for remote login */
struct exit_status ut_exit; /* The exit status of a process
marked as DEAD_PROCESS */
/* The ut_session and ut_tv fields must be the same size when
compiled 32- and 64-bit. This allows data files and shared
memory to be shared between 32- and 64-bit applications */
#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
int32_t ut_session; /* Session ID, used for windowing */
struct
{
int32_t tv_sec; /* Seconds */
int32_t tv_usec; /* Microseconds */
} ut_tv; /* Time entry was made */
#else
long int ut_session; /* Session ID, used for windowing */
struct timeval ut_tv; /* Time entry was made */
#endif
int32_t ut_addr_v6[4]; /* IP address of remote host */
char __unused[20]; /* Reserved for future use */
};
/* Backwards compatibility hacks. */
@ -176,6 +190,33 @@ and some versions of
.BR getty (1).
Neither of these programs creates the file, so if it is
removed, record-keeping is turned off.
.PP
Note that on \fBbiarch\fP platforms, i.e. systems which can run both
32-bit and 64-bit applications (x86-64, ppc64, s390x, etc.),
\fIut_tv\fP is the same size in 32-bit mode as in 64-bit mode.
The same goes for \fIut_session\fP and \fIut_time\fP if they are present.
This allows data files and shared memory to be shared between
32-bit and 64-bit applications.
.\" FIXEME -- maybe include the following (MTK, 15 Sep 2005)
.\" The following example is the recommended
.\" method for filling in the \fIut_tv\fP member:
.\" .RS
.\" .nf
.\" .sp
.\" .ta 3i
.\" struct utmp ut;
.\" ...
.\" if (sizeof (ut.ut_tv) == sizeof (struct timeval))
.\" gettimeofday((struct timeval *) &ut.ut_tv, NULL);
.\" else {
.\" struct timeval tv;
.\" gettimeofday(&tv, NULL);
.\" ut.ut_tv.tv_sec = tv.tv_sec;
.\" ut.ut_tv.tv_usec = tv.tv_usec;
.\" }
.\" .SP
.\" .fi
.\" .RE
.SH FILES
/var/run/utmp
.br