summaryrefslogtreecommitdiff
path: root/hwclock
AgeCommit message (Collapse)AuthorFilesLines
2011-01-31Merge remote branch 'origin/master'LaMont Jones1-4/+16
Conflicts: mount/mount.8 mount/mount.c
2010-12-31hwclock: allow setting of RTC when it contains invalid dataPeter Tyser1-4/+16
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>
2010-12-29Merge remote branch 'origin/master'LaMont Jones2-27/+20
Conflicts: login-utils/Makefile.am mount/lomount.c text-utils/od.1
2010-11-30rename util-linux-ng back to util-linuxKarel Zak1-2/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-15hwclock: [m68k] unbreak FTBFS with recent (>= 2.4.18?) kernelsThorsten Glaser1-25/+18
The old KDGHWCLK ioctl was removed from the Linux kernel quite some time ago. The kd.c source file of hwclock contains fallback code to handle this, but the fallback code never could have compiled or was not fixed along other code changes. The Linux kernel nowadays igno- res the ioctl entirely so removing it unless provided by the kernel headers, to keep it working on very old kernels, seems the sensible thing to do, as the comments say m68k only and deprecated (which is correct AFAICT). According to pickaxe on gitweb, it was removed in 2002: http://git.kernel.org/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git;a=commit;h=a915e414af5fc541ff62ef0bfec847457ae650bc Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578168 Signed-off-by: Thorsten Glaser <tg@mirbsd.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-05-14Merge remote branch 'origin/master' into HEADLaMont Jones2-11/+37
Conflicts: lib/fsprobe.c mount/lomount.c
2010-03-29hwclock: add --predict for predicting RTC reading at a given timeTimo Juhani Lindfors2-11/+37
Implement new option --predict that predicts what the RTC will read at a time given by the --date option. This is useful for example if you need to setup an RTC wakeup time to distant future and want to account for the RTC drift. Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-19Merge remote branch 'origin/master'LaMont Jones2-25/+27
Conflicts: mount/lomount.c
2009-10-16hwclock: use c.hKarel Zak1-2/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-13hwclock: set kernel timezone with --systz --utcScott James Remnant1-11/+8
Even though --systz doesn't need to change the system clock when the hardware clock is in UTC time (--systz --utc), it does need to set the kernel timezone so that FAT timestamps, etc. will be correct. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-10-13hwclock: do not access hardware clock when using --systzScott James Remnant1-12/+17
When using --systz we do not read from the hardware clock, so there is no need to search for a hardware clock. Indeed, we may be running hwclock --systz before /dev is mounted. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-10-10Merge remote branch 'origin/master'LaMont Jones1-1/+0
2009-10-09Remove now unused <sys/ioctl.h> includesGuillem Jover1-1/+0
Those became unused with the switch to the blkdev functions. Signed-off-by: Guillem Jover <guillem@hadrons.org>
2009-08-23Merge commit 'origin/master'LaMont Jones2-42/+44
Conflicts: getopt/getopt.1
2009-08-21replace usleep() for systems that don't have themDaniel Mierswa1-0/+1
This function is marked obsolete in POSIX.1-2001 and removed in POSIX.1-2008. Conditionally replaced with nanosleep(). Signed-off-by: Daniel Mierswa <impulze@impulze.org>
2009-08-20hwclocks: use time limit for KDGHWCLK busy waitKarel Zak1-19/+19
Currently the busy wait in synchronize_to_clock_tick_kd() is restricted by number of loops. It's better to use time limit (1.5s). We already use this method for RTC. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-08-17hwclock.8: formattingPeter Breitenlohner1-23/+24
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-07-21Merge commit 'origin/master'LaMont Jones1-1/+1
Conflicts: AUTHORS NEWS config/include-Makefile.am configure.ac mount/lomount.c po/POTFILES.in po/ca.po po/cs.po po/da.po po/de.po po/es.po po/et.po po/eu.po po/fi.po po/fr.po po/hu.po po/id.po po/it.po po/ja.po po/nl.po po/pl.po po/pt_BR.po po/ru.po po/sl.po po/sv.po po/tr.po po/uk.po po/util-linux-ng.pot po/vi.po po/zh_CN.po
2009-05-27hwclock: fix mismatched popen/fclose.John Keeping1-1/+1
date_child_fp is opened by popen, so should be closed with pclose. Signed-off-by: John Keeping <john.keeping@lineone.net> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
2009-03-20Merge commit 'origin/master'LaMont Jones2-8/+120
Conflicts: NEWS config/include-Makefile.am configure.ac mount/Makefile.am mount/mount.c po/ca.po po/cs.po po/da.po po/de.po po/es.po po/et.po po/eu.po po/fi.po po/fr.po po/hu.po po/id.po po/it.po po/ja.po po/nl.po po/pl.po po/pt_BR.po po/ru.po po/sl.po po/sv.po po/tr.po po/uk.po po/util-linux-ng.pot po/vi.po po/zh_CN.po
2009-03-10hwclock: add --systz option to set system clock from itselfScott James Remnant2-8/+120
Since the system clock time is already set from the hardware clock by the kernel (when compiled with CONFIG_RTC_HCTOSYS), there's no particular need to read the hardware clock again. This option sets the system clock using itself as a reference if the hardware clock was in local time. The resulting system clock time is in UTC, with the kernel timezone set to the difference. [kzak@redhat.com: - fix the condition that controls read_adjtime() call] Signed-off-by: Scott James Remnant <scott@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2008-12-15Merge commit 'origin/master'LaMont Jones3-41/+18
Conflicts: mount/mount.8
2008-11-26hwclock: clock.h is included more than onceKarel Zak1-4/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-10-16hwclock: remove "cli" and "sti" from i386 CMOS codeKarel Zak1-25/+4
The protection against context switch is nonsense. There is possible to optimize the access to CMOS by mlockall(MCL_CURRENT) and SCHED_FIFO. For more details see: http://lkml.org/lkml/2008/10/12/132 Reported-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2008-10-03hwclock: several strings without gettext callsPedro Ribeiro2-12/+12
Signed-off-by: Pedro Ribeiro <p.m42.ribeiro@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2008-09-25Disable the fallback clause in hwclock when /dev/rtc cannot be opened.Tim Gardner1-0/+10
hwclock should not access the x86 RTC using I/O instructions unless explicitly requested from the command line (--directisa). This issue was encountered while debugging a boot time race when hwclock.sh was run in parallel. Addresses-Ubuntu-Bug: 274402 Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Signed-off-by: LaMont Jones <lamont@debian.org>
2008-08-23Merge commit 'origin/master'LaMont Jones3-49/+68
2008-08-18hwclock: don't open /dev/rtc repeatedlyKarel Zak1-22/+30
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-13hwclock: read_hardware_clock_rtc() need to return error codesKarel Zak1-3/+3
We shouldn't ignore RTC_RD_TIME/RTCGET error codes. Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-13hwclock: delay loop in set_hardware_clock_exactKalev Soikonen1-8/+12
- Avoid delaying 1.5 seconds when 0.5 will do. - Guard for forward time resets as well. [kzak@redhat.com: - fix the "Delaying.." debug message - add comments] Signed-off-by: Kalev Soikonen <ksop@hot.ee> Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-13hwclock: use time limit for synchronization busy waitKarel Zak3-12/+14
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-13hwclock: use carefully synchronize_to_clock_tick() return codesKarel Zak1-3/+8
* It seems that rtc-isl1208 0-006f: chip found, driver version 0.3 rtc-isl1208 0-006f: rtc core: registered rtc-isl1208 as rtc0 rtc-isl1208 0-006f: rtc power failure detected, please set clock. causes that hardware clock returns persistent time and synchronization is impossible. The hwclock(8) has to ignore this problem and allows to set clock anyway. * synchronize_to_clock_tick() shouldn't to print the "...got clock tick" debug message in case of failure. Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-12hwclock: remove x86_64-specific bogonDavid Brownell1-1/+1
I was puzzled why "hwclock" wrongly reported my x86_64 sytem didn't support RTC update interrupts. Bogus #ifdef, that's why ... added by the 2.11y patch (from 2.11t). Probably this whole #ifdef should just vanish ... if the kernel rejects UIE_ON, the program ought to just cope with it. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2008-08-11Merge commit 'origin/master'LaMont Jones3-84/+69
Conflicts: mount/mount.c
2008-08-06hwclock: cleanup help output and man pageKarel Zak2-65/+42
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-06hwclock: unshadow a diagnostic printfKalev Soikonen1-5/+3
- Bogus if test means one message is never produced. - Avoid needless passing of a global variable (debug). The --test option flag ought to be a global as well (and perhaps -n/--dry-run). Signed-off-by: Kalev Soikonen <ksop@hot.ee>
2008-06-17hwclock: always reads hardware clockKarel Zak2-10/+18
It's a pity that hwclock first tries to read the clock when running hwclock --systohc --noadjfile --utc and exits as this fails. I cannot see a reason to read first in that case. Old version: # hwclock --systohc --noadjfile --utc --debug hwclock from util-linux-ng 2.14 Using /dev interface to clock. Assuming hardware clock is kept in UTC time. Waiting for clock tick... /dev/rtc does not have interrupt functions. Waiting in loop for time from /dev/rtc to change ...got clock tick Time read from Hardware Clock: 2008/06/17 11:18:24 Hw clock time : 2008/06/17 11:18:24 = 1213701504 seconds since 1969 Time elapsed since reference time has been 0.904855 seconds. Delaying further to reach the next full second. Setting Hardware Clock to 11:18:24 = 1213701504 seconds since 1969 ioctl(RTC_SET_TIME) was successful. New version: # hwclock --systohc --noadjfile --utc --debug hwclock from util-linux-ng 2.14 Using /dev interface to clock. Assuming hardware clock is kept in UTC time. Time elapsed since reference time has been 0.572151 seconds. Delaying further to reach the next full second. Setting Hardware Clock to 11:18:52 = 1213701532 seconds since 1969 ioctl(RTC_SET_TIME) was successful. Addresses-Debian-Bug: #478663 Signed-off-by: Karel Zak <kzak@redhat.com>
2008-06-16hwclock: omit warning about drift if --noadjfile givenMatthias Koenig1-4/+6
Currently, if hwclock is given the --noadjfile option it will nevertheless display information about the drift rate when invoked with the --debug option. Signed-off-by: Matthias Koenig <mkoenig@suse.de>
2008-04-15Merge commit 'origin/master'LaMont Jones1-0/+1
Conflicts: mount/lomount.c mount/lomount.h mount/mount.c
2008-04-14build-sys: ignore a bunch of generated files, mostly binariesJames Youngman1-0/+1
Signed-off-by: James Youngman <jay@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2008-04-09Merge commit 'origin/master'LaMont Jones2-29/+51
2008-04-09hwclock: add --adjfile=path optionKarel Zak2-29/+51
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-12-17Merge commit 'origin/master'LaMont Jones1-1/+1
2007-12-17build-sys: use dist_man_MANS instead of man_MANSStepan Kasal1-1/+1
Signed-off-by: Stepan Kasal <skasal@redhat.com>
2007-12-05Merge commit 'origin/master'LaMont Jones1-1/+1
2007-12-04hwclock: check for ENODEVDavid Woodhouse1-1/+1
/sbin/hwclock is supposed to fall back to using /dev/rtc0 if /dev/rtc isn't working (which it isn't, because mkinitrd creates it with the old device numbers, and we're switching to the new RTC_CLASS driver). Unfortunately, it'll only cope if the error it gets is ENOENT (i.e. the device node doesn't exist). It doesn't fall back to the next device in the list if the error is ENODEV, which is what happens when the device node exists, but there's no driver. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-26Merge commit 'origin/master'LaMont Jones1-0/+1
Conflicts: mount/Makefile.am mount/mount.c
2007-10-26hwclock: do not create a zero adjfileAlain Guibert1-0/+1
When hwclock --hctosys is started very early during the system startup, with / still mounted read-only, and there was no /etc/adjtime file, hwclock fails creating a default adjfile full of zeroes, and prints an error message. I believe that such zero adjfile is not necessary, because it means exactly the same as no adjfile at all. The attached patch prevents creation of a zero adjfile, of course unless something gets changed (this never happens during a --hctosys). Signed-off-by: Alain Guibert <alguibert+ulng@free.fr>
2007-09-21Merge commit 'origin/master'LaMont Jones1-18/+15
2007-09-20hwclock: fix --rtc optionMatthias Koenig1-18/+15
The --rtc option does not set the name of the device correctly. It still uses /dev/rtc even if the --rtc option is given. Testcase: $ mv /dev/rtc /dev/foo $ hwclock --show --debug --rtc=/dev/foo hwclock from util-linux-2.13-rc2 Using /dev interface to clock. Last drift adjustment done at 1190198135 seconds after 1969 Last calibration done at 1190198135 seconds after 1969 Hardware clock is on local time Assuming hardware clock is kept in local time. Waiting for clock tick... hwclock: open() of /dev/rtc failed, errno=2: No such file or directory. ...got clock tick Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>