summaryrefslogtreecommitdiffstats
path: root/hwclock
Commit message (Collapse)AuthorAgeFilesLines
* hwclock: cleanup strtoxx_or_err()Karel Zak2012-05-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix typos found by misspellingsBernhard Voelker2012-04-232-3/+3
| | | | | | | | | | | | | | | The tool misspellings (https://github.com/lyda/misspell-check) detected several typos. Command used: $ git ls-files | grep -v ^po/ | misspellings -f - * isosize: Fix typo in usage string. * configure.ac: Fix typo in help string of --enable-most-builds option. * fdisk: Fix typo in man page. * libblkid, blkid, mount: Likewise. * Fix various typos in docs and in source code comments. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* hwclock: verify writing to streams was successfulSami Kerola2012-04-041-2/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: enhance readability of the autotools filesSami Kerola2012-02-281-1/+6
| | | | | | | | Several horizontal lists are turned to vertical, and sorted to alphabetical order. Additionally spaces are converted to tabs where ever possible. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: remove never read valueKarel Zak2012-02-021-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: clean usage, remove redundat codeKarel Zak2012-02-021-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove non-ANSI function declaration [smatch scan]Karel Zak2012-01-172-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use %m in format string instead of %s and strerror(errno)Petr Uzel2011-09-271-8/+8
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* Merge branch 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetitKarel Zak2011-08-313-19/+14Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit: docs: remove duplicated text docs: require kernel support before accepting use of it docs: note about independent super block structs docs: add libmount & libblkid debug instructions Documentation: add debugging doc arch: start using arch as a usage() example docs: new file Documentation/release-schedule.txt docs: move setuid information from reame to hwclock.8 docs: clean up old readme files docs: copy contributors from legacy files to AUTHORS docs: new file Documentation/howto-man-page.txt docs: new file Documentation/source-code-management.txt docs: new file Documentation/howto-contribute.txt docs: new file Documentation/howto-compilation.txt docs: tell what the Documentation/ is about docs: add usage() howto for contributors docs: Documentation directory added docs: remove README.clear
| * docs: move setuid information from reame to hwclock.8Sami Kerola2011-08-231-0/+14
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * docs: Documentation directory addedSami Kerola2011-08-122-19/+0Star
| | | | | | | | | | | | | | | | Move readme, licence, change log, relese notes and other supplementary files to a Documentation directory. This commit does not change contents of any other but few Makefile.am files. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | docs: uniformize the header and footer lines in man pagesBenno Schulenberg2011-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | Use dates without the day, use the full month name, put "util-linux" in the lower left corner, and "User Commands" or "System Administration" at the top center. Also improve here and there the one-line program description. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* | hwclock: use <var> in usage()Karel Zak2011-08-161-27/+27
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | hwclock: indent usage()Karel Zak2011-08-161-45/+38Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | hwclock: in man page move --date and --epoch from Functions to OptionsBenno Schulenberg2011-08-161-53/+65
| | | | | | | | | | | | | | Also improve the synopsis and some wording and a bit of formatting, add the --help option, and say that --show is the default function. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* | hwclock: when cutting up help texts anyway, do it into small chunksBenno Schulenberg2011-08-161-25/+29
|/ | | | | | | | Also do it at sensible boundaries, improve some of the wording, and indent continuation lines for clarity. Also document -V instead of -v for --version, to conform to the majority of utilities. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* hwclock: tiny change in commentKarel Zak2011-07-281-1/+1
| | | | | | ... to keep 'make checkconfig' happy. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: fix gcc warning (uninitialized variable)Karel Zak2011-07-271-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: validate numeric option argumentsSami Kerola2011-07-263-6/+8
| | | | | | Instead atoi() use strtoul_or_err(). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: move long options away from global scopeSami Kerola2011-07-261-52/+70
| | | | | | | In addition `long only' options are made unreachable by using 8-bit characters. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: add variable initializationSami Kerola2011-07-261-2/+2
| | | | | | | The only variable found causing `conditional jump or move depends on uninitialized value' is fixed. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: remove goto statementSami Kerola2011-07-261-13/+21
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: fix compiler warningsSami Kerola2011-07-262-35/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | hwclock.c: In function 'manipulate_epoch': hwclock.c:1299:29: warning: unused parameter 'getepoch' [-Wunused-parameter] hwclock.c:1299:50: warning: unused parameter 'setepoch' [-Wunused-parameter] hwclock.c:1300:14: warning: unused parameter 'epoch_opt' [-Wunused-parameter] hwclock.c:1300:36: warning: unused parameter 'testing' [-Wunused-parameter] hwclock.c: In function 'usage': hwclock.c:1373:1: warning: embedding a directive within macro arguments is not portable [enabled by default] hwclock.c:1377:1: warning: embedding a directive within macro arguments is not portable [enabled by default] hwclock.c:1383:1: warning: embedding a directive within macro arguments is not portable [enabled by default] hwclock.c:1385:1: warning: embedding a directive within macro arguments is not portable [enabled by default] cmos.c: In function 'outb': cmos.c:84:15: warning: unused parameter 'a' [-Wunused-parameter] cmos.c:84:22: warning: unused parameter 'b' [-Wunused-parameter] cmos.c: In function 'inb': cmos.c:88:13: warning: unused parameter 'c' [-Wunused-parameter] cmos.c: In function 'atomic': cmos.c:265:20: warning: unused parameter 'name' [-Wunused-parameter] cmos.c: In function 'i386_iopl': cmos.c:544:32: warning: unused parameter 'level' [-Wunused-parameter] cmos.c: In function 'get_permissions_cmos': cmos.c:565:8: warning: unused variable 'errsv' [-Wunused-variable] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: move path definitions to pathnames.hSami Kerola2011-07-261-19/+9Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: use libc error printing functionsSami Kerola2011-07-265-207/+151Star
| | | | | | In addition numeric exit values are converted to defined strings. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: include-what-you-use header checkSami Kerola2011-07-264-17/+28
| | | | | | One deletion, few adds and sort to include lists. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: coding style clean upSami Kerola2011-07-265-2067/+2159
| | | | | | | | Despide amount of the change this change should be harmless. Everything is about indendation, comment restructuring etc not code changes. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: remove misleading informationSami Kerola2011-07-242-11/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: remove clock-ppc.cSami Kerola2011-07-241-459/+0Star
| | | | | | There is no need to keep this file hanging around anymore. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: Don't use asm/io.h if sys/io.h can't be foundJosiah Worcester2011-06-141-5/+13
| | | | | | | [kzak@redhat.com: - check for obsolete asm/io.h in configure.ac] Signed-off-by: Josiah Worcester <josiahw@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove unused variablesKarel Zak2011-06-081-4/+6
| | | | | | | | | hwclock.c: In function ‘set_hardware_clock’: hwclock.c:467:7: warning: variable ‘err’ set but not used [-Wunused-but-set-variable] hwclock.c: In function ‘main’: hwclock.c:1461:7: warning: variable ‘ARCconsole’ set but not used [-Wunused-but-set-variable] Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: build on non-LinuxSamuel Thibault2011-03-113-1/+30
| | | | | | | | Thanks to the direct ISA method and by disabling the RTC get/set epoch functionality, hwclock can work fine on non-Linux systems which provide ioperm or iopl. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* hwclock: make RTC default to UTC timeDaniel Drake2011-02-212-3/+3
| | | | | | | | | | | | | | If /etc/adjtime doesn't specify UTC or LOCAL, rtcwake defaults to UTC and hwclock defaults to LOCAL. Switch hwclock to meet the behaviour of rtcwake (default=UTC), also matching the kernel's CONFIG_RTC_HCTOSYS behaviour. The user impact of this change should be minimal, as anyone who has run "hwclock --systohc" before will have their UTC/LOCAL choice already recorded in /etc/adjtime. Signed-off-by: Daniel Drake <dsd@laptop.org>
* hwclock: allow setting of RTC when it contains invalid dataPeter Tyser2010-12-311-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>
* rename util-linux-ng back to util-linuxKarel Zak2010-11-301-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: [m68k] unbreak FTBFS with recent (>= 2.4.18?) kernelsThorsten Glaser2010-11-151-25/+18Star
| | | | | | | | | | | | | | | | | | 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>
* hwclock: add --predict for predicting RTC reading at a given timeTimo Juhani Lindfors2010-03-292-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>
* hwclock: use c.hKarel Zak2009-10-161-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: set kernel timezone with --systz --utcScott James Remnant2009-10-131-11/+8Star
| | | | | | | | 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>
* hwclock: do not access hardware clock when using --systzScott James Remnant2009-10-131-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>
* Remove now unused <sys/ioctl.h> includesGuillem Jover2009-10-091-1/+0Star
| | | | | | Those became unused with the switch to the blkdev functions. Signed-off-by: Guillem Jover <guillem@hadrons.org>
* replace usleep() for systems that don't have themDaniel Mierswa2009-08-211-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>
* hwclocks: use time limit for KDGHWCLK busy waitKarel Zak2009-08-201-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>
* hwclock.8: formattingPeter Breitenlohner2009-08-171-23/+24
| | | | Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
* hwclock: fix mismatched popen/fclose.John Keeping2009-05-271-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>
* hwclock: add --systz option to set system clock from itselfScott James Remnant2009-03-102-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>
* hwclock: clock.h is included more than onceKarel Zak2008-11-261-4/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove "cli" and "sti" from i386 CMOS codeKarel Zak2008-10-161-25/+4Star
| | | | | | | | | | 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>
* hwclock: several strings without gettext callsPedro Ribeiro2008-10-032-12/+12
| | | | | Signed-off-by: Pedro Ribeiro <p.m42.ribeiro@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: don't open /dev/rtc repeatedlyKarel Zak2008-08-181-22/+30
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>