mirror of https://github.com/mkerrisk/man-pages
Consolidate duplicated information about ut_tv and ut_session
on biarch platforms.
This commit is contained in:
parent
b40e1143a6
commit
3721bd3f13
62
man5/utmp.5
62
man5/utmp.5
|
@ -210,34 +210,6 @@ or
|
||||||
.BR agetty (8)).
|
.BR agetty (8)).
|
||||||
None of these programs creates the file, so if it is
|
None of these programs creates the file, so if it is
|
||||||
removed, record-keeping is turned off.
|
removed, record-keeping is turned off.
|
||||||
.PP
|
|
||||||
Note that on \fIbiarch\fP platforms, that is, 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.
|
|
||||||
Since \fIut_tv\fP may not be the same as \fIstruct timeval\fP,
|
|
||||||
then instead of the call:
|
|
||||||
.in +4n
|
|
||||||
.nf
|
|
||||||
.sp
|
|
||||||
gettimeofday((struct timeval *) &ut.ut_tv, NULL);
|
|
||||||
.fi
|
|
||||||
.in
|
|
||||||
|
|
||||||
the following method of setting this field is recommended:
|
|
||||||
.in +4n
|
|
||||||
.nf
|
|
||||||
.sp
|
|
||||||
struct utmp ut;
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
ut.ut_tv.tv_sec = tv.tv_sec;
|
|
||||||
ut.ut_tv.tv_usec = tv.tv_usec;
|
|
||||||
.fi
|
|
||||||
.in
|
|
||||||
.SH FILES
|
.SH FILES
|
||||||
/var/run/utmp
|
/var/run/utmp
|
||||||
.br
|
.br
|
||||||
|
@ -284,9 +256,12 @@ binaries using the old libc5 struct will corrupt
|
||||||
The file format is machine-dependent, so it is recommended that it be
|
The file format is machine-dependent, so it is recommended that it be
|
||||||
processed only on the machine architecture where it was created.
|
processed only on the machine architecture where it was created.
|
||||||
.PP
|
.PP
|
||||||
Note that on platforms which can run both 32-bit and 64-bit applications
|
Note that on \fIbiarch\fP platforms, that is, systems which can run both
|
||||||
(x86-64, ppc64, s390x, etc.), the sizes of the fields of a \fIutmp\fP struct
|
32-bit and 64-bit applications (x86-64, ppc64, s390x, etc.),
|
||||||
must be the same in 32-bit mode as in 64-bit mode.
|
\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.
|
||||||
This is achieved by changing the type of
|
This is achieved by changing the type of
|
||||||
.I ut_session
|
.I ut_session
|
||||||
to
|
to
|
||||||
|
@ -299,10 +274,27 @@ fields
|
||||||
.I tv_sec
|
.I tv_sec
|
||||||
and
|
and
|
||||||
.IR tv_usec .
|
.IR tv_usec .
|
||||||
(Thus, in order to fill it, first get the
|
Since \fIut_tv\fP may not be the same as \fIstruct timeval\fP,
|
||||||
time into a real \fIstruct timeval\fP,
|
then instead of the call:
|
||||||
then copy the two fields to
|
.in +4n
|
||||||
.IR ut_tv .)
|
.nf
|
||||||
|
.sp
|
||||||
|
gettimeofday((struct timeval *) &ut.ut_tv, NULL);
|
||||||
|
.fi
|
||||||
|
.in
|
||||||
|
|
||||||
|
the following method of setting this field is recommended:
|
||||||
|
.in +4n
|
||||||
|
.nf
|
||||||
|
.sp
|
||||||
|
struct utmp ut;
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
ut.ut_tv.tv_sec = tv.tv_sec;
|
||||||
|
ut.ut_tv.tv_usec = tv.tv_usec;
|
||||||
|
.fi
|
||||||
|
.in
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
This man page is based on the libc5 one, things may work differently now.
|
This man page is based on the libc5 one, things may work differently now.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
|
|
Loading…
Reference in New Issue