5606df53d3
In some cases the date/time stored in an RTC can be corrupted, eg due to loss of power, before its been initially set, etc. When this occurs the RTC_RD_TIME ioctl can fail since the Linux kernel determines that the RTC contains invalid data. Currently, when setting an RTC using hwclock, hwclock performs a number of RTC_RD_TIME ioctls before setting the RTC. When one of these ioctls fails, hwclock bombs out and the corrupted RTC data can't be overwritten. Thus once an RTC is corrupted, it can't be fixed via hwclock*. To work around the above issue we can make hwclock not exit when a RTC_RD_TIME failure occurs during the process of setting the RTC. This allows the RTC to be set even when it contains an invalid value, although it is not synchronized to a clock tick before it is set. * 'hwclock --utc --noadjfile --set --date="11/23/10 17:19:00' currently works to fix a corrupted RTC, but a user couldn't determine this without digging through the source code. Signed-off-by: Peter Tyser <ptyser@xes-inc.com> |
||
---|---|---|
.. | ||
.gitignore | ||
Makefile.am | ||
README.hwclock | ||
clock-ppc.c | ||
clock.h | ||
cmos.c | ||
hwclock.8 | ||
hwclock.c | ||
kd.c | ||
rtc.c |
README.hwclock
Hwclock is a program that runs under Linux and sets and queries the Hardware Clock, which is often called the Real Time Clock, RTC, or CMOS clock. Sometimes, you need to install hwclock setuid root. If you want users other than the superuser to be able to display the clock value using the direct ISA I/O method, install it setuid root. If you have the /dev/rtc interface on your system or are on a non-ISA system, there's probably no need for users to use the direct ISA I/O method, so don't bother. To install setuid root, do something like this: chmod a=rx,u=s /sbin/hwclock In any case, hwclock will not allow you to set anything unless you have the superuser _real_ uid. (This is restriction is not necessary if you haven't installed setuid root, but it's there for now). You may want to preformat and/or compress the man page before installing. If you want to build hwclock, just cd to the source directory and invoke make with no parameters. hwclock calls option processing routines in the libsshopt library, which is part of Sverre H. Huseby's "shhopt" package. You can find a more authoritative copy of this package on metalab (ftp://metalab.unc.edu/pub/Linux/libs/shhopt-X.Y).