Describe new adjkerntz variant + various changes from jdp

This commit is contained in:
Andrey A. Chernov 1996-04-05 23:37:08 +00:00
parent 9c2c5c6d6e
commit bacbb38233
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15063

View File

@ -1,4 +1,4 @@
.\" Copyright (C) 1993 by Andrew A. Chernov, Moscow, Russia. .\" Copyright (C) 1993-1996 by Andrey A. Chernov, Moscow, Russia.
.\" All rights reserved. .\" All rights reserved.
.\" .\"
.\" Redistribution and use in source and binary forms, with or without .\" Redistribution and use in source and binary forms, with or without
@ -22,69 +22,110 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd December 15, 1993 .Dd April 4, 1996
.Dt ADJKERNTZ 8 .Dt ADJKERNTZ 8
.Os FreeBSD .Os FreeBSD
.Sh NAME .Sh NAME
.Nm adjkerntz .Nm adjkerntz
.Nd "adjusts the kernel time if the machine runs wall CMOS clock" .Nd "adjust local time CMOS clock to reflect time zone changes and keep current timezone offset for the kernel"
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm adjkerntz .Nm adjkerntz
.Fl i .Fl i
.Nm adjkerntz .Nm adjkerntz
.Fl a .Fl a Op Fl s
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm Adjkerntz .Nm Adjkerntz
fixes kernel time (makes it UTC) using the current wall CMOS clock value, maintains the proper relationship between the kernel clock, which
the current time zone rule and the kernel timezone value. The adjustment is is always set to UTC, and the CMOS clock, which may be set to local
enabled only if the file time.
.Nm Adjkerntz
also informs the kernel about machine timezone shift to
maintain proper timestamps for local time file systems like MS-DOS one.
If the file
.Pa /etc/wall_cmos_clock .Pa /etc/wall_cmos_clock
exists, in other cases it is assumed that the machine runs UTC CMOS clock and exists, it means that CMOS clock keep local time (MS-DOS and MS-Windows
.Nm adjkerntz compatible mode),
does nothing. if that file does not exist it means that CMOS clock keep UTC time.
.Pp .Pp
The adjustment is needed at boot stage and when a time zone Adjustments may be needed at system startup and shutdown, and
change occurs, so whenever a time zone change occurs.
To handle these different situations,
.Nm adjkerntz .Nm adjkerntz
can be called in two forms: is invoked in two ways:
.Bl -tag -width 4n .Bl -tag -width 4n
.It Cm Fl i .It Cm Fl i
initialization call from This form handles system startups and shutdowns.
.Nm Adjkerntz
is invoked with this option from
.Pa /etc/rc .Pa /etc/rc
(before any daemons are started). before any other daemons have been started.
.Nm Adjkerntz .Nm Adjkerntz
makes the adjustment of kernel clock (CMOS clock not touched) puts itself into the background.
and the initial time zone offset is stored into Then for wall CMOS clock
.Pa adjkerntz .Nm adjkerntz
kernel variable reads the local time from the it
for following subsequent and sets the kernel clock to the corresponding UTC time.
.Nm "'adjkerntz -a'"
calls. Then it goes to background pause which ends with SIGTERM.
After receiving SIGTERM it acts like
.Nm "'adjkerntz -a'"
to insure that the CMOS clock reflects the current local time zone.
.It Cm Fl a
This form is needed, when time zone changes occur.
.Nm Adjkerntz .Nm Adjkerntz
uses the previously stored also stores the local time zone offset into the
time zone offset and the changed time zone rule to .Pa machdep.adjkerntz
produce the new time zone offset, fix the CMOS clock kernel variable, for use by subsequent invocations of
(kernel clock not touched) .Nm "'adjkerntz -a'"
and store the new and local time file systems.
offset into .Pp
.Pa adjkerntz For wall CMOS clock
kernel variable .Nm "'adjkerntz -i'"
too. pauses, and remains inactive as a background daemon until it
It is recommended to use this form in root's receives a SIGTERM.
The SIGTERM will normally be sent by
.Xr init 8
when the system leaves multi-user mode (usually, because the system
is being shut down).
After receiving the SIGTERM,
.Nm adjkerntz
reads the UTC kernel clock and updates the CMOS clock, if necessary,
to ensure that it reflects the current local time zone.
Then
.Nm adjkerntz
exits.
.It Cm Fl a Op Fl s
This form is used to update the wall CMOS clock and kernel
.Pa machdep.adjkerntz
variable when time zone changes occur,
e.g., when entering or leaving daylight savings time.
.Nm Adjkerntz
uses the kernel clock's UTC time,
the previously stored
time zone offset, and the changed time zone rule to
calculate a new time zone offset.
It stores the new offset into the
.Pa machdep.adjkerntz
kernel variable, and updates the wall CMOS clock to the new local time.
If
.Nm "'adjkerntz -a'"
starts at nonexisten time (inside timezone change), it exits
with warning diagnostic unless
.Fl s
option is used, in this case
.Nm adjkerntz
sleep 30 minutes and tries again.
.Pp
This form should be invoked from root's
.Xr crontab 5 .Xr crontab 5
every half of a hour from 0am to 4am every half hour between midnight and 4am, when most modern time
since this times matches most modern time zone changes. zone changes occur.
Warning: don't use
.Fl s
option in
.Xr crontab 5
command line or multiply
.Nm "'adjkerntz -a'"
copies can conflict with each other.
.El .El
.Pp .Pp
.Nm Adjkerntz .Nm Adjkerntz
clears the kernel timezone structure and makes kernel always run at UTC clears the kernel timezone structure and makes the kernel clock run
time zone. in the UTC time zone.
Super-user privilege is required for all operations. Super-user privileges are required for all operations.
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Bl -tag -width Fl .Bl -tag -width Fl
.It Ev TZ .It Ev TZ
@ -104,26 +145,26 @@ and
.Xr zic 8 . .Xr zic 8 .
.It Pa /etc/wall_cmos_clock .It Pa /etc/wall_cmos_clock
Empty file. Empty file.
Presence of it indicates that the machine runs wall CMOS clock, Its presence indicates that the machine's CMOS clock is set to local
absence indicates UTC CMOS clock. time, while its absence indicates a UTC CMOS clock.
.Sh SEE ALSO .Sh SEE ALSO
.Xr tzset 3 , .Xr tzset 3 ,
.Xr zic 8 , .Xr zic 8 ,
.Xr rc 8 , .Xr rc 8 ,
.Xr crontab 5 , .Xr crontab 5 ,
.Xr sysctl 8 , .Xr sysctl 8 ,
.Xr /usr/sbin/tzsetup .Xr tzsetup 8 .
.Sh DIAGNOSTICS .Sh DIAGNOSTICS
No diagnostics. No diagnostics.
If any error occurs, an error message printed via If an error occurs,
.Xr syslog 3
and
.Nm adjkerntz .Nm adjkerntz
exits with return code greater than zero. logs an error message via
.Xr syslog 3
and exits with a nonzero return code.
.Sh AUTHOR .Sh AUTHOR
Andrew A. Chernov <ache@astral.msk.su> Andrey A. Chernov <ache@astral.msk.su>
.Sh HISTORY .Sh HISTORY
The The
.Nm adjkerntz .Nm adjkerntz
command appeared in FreeBSD 1.0.1 command appeared in FreeBSD 1.0.1.