summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock-cmos.c
Commit message (Collapse)AuthorAgeFilesLines
* hwclock: use CMOS clock only if availableCarlos Santos2019-07-151-41/+6Star
| | | | | | | | | | | | - Add --disable-hwclock-cmos configuration argument - Add USE_HWCLOCK_CMOS (enabled by default for i386/x86_64) - Add define(USE_HWCLOCK_CMOS) - Compile hwclock-cmos.c only if USE_HWCLOCK_CMOS is true - Remove all unnecessary #ifdefs from hwclock-cmos.c - Add #ifdef USE_HWCLOCK_CMOS around the determine_clock_access_method() call in hwclock.c Signed-off-by: Carlos Santos <unixmania@gmail.com>
* hwclock: fix warningKarel Zak2018-07-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: add --delay <seconds>Karel Zak2018-07-181-0/+6
| | | | | | | | | | | * add command line option --delay <seconds> * read RTC type from /sys/class/rtc/rtc<N>/name * default to 0.5 (500ms) for rtc_cmos or when RTC type is impossible determine; otherwise delay is 0. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove bool type definitionSami Kerola2017-08-301-9/+5Star
| | | | | | | | | Use plain int instead of type defining it to a boolean, and use numbers to signify true or false as we do everywhere else in this source tree. And in hwclock-cmos.c file booleans weren't even needed, to the related code is removed. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: remove custom errno stringJ William Piggott2017-07-311-5/+1Star
| | | | | | | | | | | | | | | | | | | | | | Custom errno messages are unnecessary and problematic for translators. hwclock --directisa hwclock: iopl() port access failed: Operation not permitted hwclock: root privileges may be required The custom errno message is misleading. We do not know what the system permissions are set to. The default errno string is correct, and enough. Patched: hwclock --directisa hwclock: iopl() port access failed: Operation not permitted root@:~# hwclock --directisa -D Using direct ISA access to the clock 2017-07-24 14:49:17.782716-0400 Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: remove dead cmos codeJ William Piggott2017-03-311-17/+0Star
| | | | | | * hwclock-cmos.c: remove unused 'century' code. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: improve cmos message stringsJ William Piggott2017-03-311-5/+4Star
| | | | | | * sys-utils/hwclock-cmos.c: improve message strings Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: remove unused atomic arg in cmosJ William Piggott2017-03-311-6/+4Star
| | | | | | * sys-utils/hwclock-cmos.c: remove unused arg for atomic() Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: remove unused cmos ctl structsJ William Piggott2017-03-311-44/+39Star
| | | | | | | | | The hwclock-cmos.c ctl structs were only used for the since removed alpha code. * sys-utils/hwclock-cmos.c: remove unused ctl structs Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: remove alpha cmosJ William Piggott2017-03-311-277/+39Star
| | | | | | | | | | | | | | | | | Remove alpha direct I/O access, use RTC instead: http://marc.info/?l=util-linux-ng&m=141682406902804 Resolves the alpha 2020 issue for util-linux: http://marc.info/?l=util-linux-ng&m=148387021519787 Now it is only the kernel's RTC problem. * sys-utils/hwclock.c: remove alpha cmos * sys-utils/hwclock-cmos.c: same * sys-utils/hwclock.h: same * sys-utils/hwclock.8.in: same Signed-off-by: J William Piggott <elseifthen@gmx.com>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-13/+13
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: remove trailing dot from messages that include system error messageSami Kerola2017-02-051-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: clarify cmos inb and outb preprocessor directivesSami Kerola2017-02-051-17/+15Star
| | | | | | | The cmos only works when architecture is i386, x86_64, or alpha. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: improve coding styleSami Kerola2017-02-051-10/+9Star
| | | | | | | | | Make string constants to be symbolical declarations. Use longer variable name for rtc and cmos function pointer values. Exclude code that is architecture specific with preprocessor directives. And remove message duplication. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: use symbolic magic values passed in between functionsSami Kerola2017-02-051-2/+4
| | | | | | | | | | The manipulate_clock() is seeing return value from busywait_for_rtc_clock_tick(). And the get_permissions_cmos() can see i386_iopl() return value. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: remove dead code and other minor fixesSami Kerola2017-02-051-1/+1
| | | | | | | | | | | | | | | | | Use #ifdef rather than #if to avoid undefined preprocessor identifier warning. Remove dead code. The #if 0 ensured the code has not been used for long time, which is good because the linux/mc146818rtc.h is not been part of user-api for long time. Value of the adjtime_p->last_calib_time is checked if it has value of zero, so testing none-zero bit later is necessarily true, and therefore does not need to be checked. And at the and remove unnecessary boolean variable. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: clarify set_cmos_epoch() codeSami Kerola2017-02-051-16/+12Star
| | | | | | | | Variable set_epoc is unnecessary, and removal of it makes it obvious what is happening in this function. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: move command-line options to control structureSami Kerola2017-02-051-66/+78
| | | | | | | | | | | | | | | The control structure is read-only everywhere else but in main(). Almost all changes are about how variables are referred, with one exception. Calls to read_adjtime() from manipulate_clock() and compare_clock() are moved to main(). This way it is possible to keep variable that tells if hwclock is using UTC-0 be part of control structure. Changes within #ifdef __alpha__ segments were tested by flipping the preprocessor directivive otherway around and getting good compilaton all the way to the point where linking on none-alpha system failed. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* hwclock: fix iopl implicit declaration warning on alphaAndreas Henriksson2015-08-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Build warning: sys-utils/hwclock-cmos.c: In function 'i386_iopl': sys-utils/hwclock-cmos.c:611:9: warning: implicit declaration of function 'iopl' [-Wimplicit-function-declaration] return iopl(level); ^ sys-utils/hwclock-cmos.c:611:2: warning: nested extern declaration of 'iopl' [-Wnested-externs] return iopl(level); ^ Also: checking sys/io.h usability... yes checking sys/io.h presence... yes checking for sys/io.h... yes Full build log: https://buildd.debian.org/status/fetch.php?pkg=util-linux&arch=alpha&ver=2.26.2-9&stamp=1440078034 Detected by/via: https://qa.debian.org/bls/packages/u/util-linux.html Please note that this has never been (build-)tested, but should hopefully resolve the warning. Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* hwclock: fix fgets unchecked return value warning on alphaAndreas Henriksson2015-08-241-4/+4
| | | | | | | | | | | | | | | | | | Build warning: sys-utils/hwclock-cmos.c: In function 'is_in_cpuinfo': sys-utils/hwclock-cmos.c:162:4: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result] fgets(field, 256, cpuinfo); Full build log: https://buildd.debian.org/status/fetch.php?pkg=util-linux&arch=alpha&ver=2.26.2-9&stamp=1440078034 Detected by/via: https://qa.debian.org/bls/packages/u/util-linux.html This change has never actually been (build-)tested on alpha, but hopefully the change should fix the warning. Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* hwclock: enable --directisa for x86_64JWP2015-01-091-4/+5
| | | | | | | Currently only x86 and Alpha can use --directisa. This patch allows x86_64 machines to use it as well. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* textual: grammarize another error messageBenno Schulenberg2014-10-011-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* hwclock: internationalizing the message of the used interfaceBenno Schulenberg2014-02-101-1/+1
| | | | | | In addition, do it in a single sentence instead of in two fragments. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* hwclock: use warn() to print cmos errorsKarel Zak2013-05-141-8/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: fix compiler warningKarel Zak2012-12-201-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: fix compiler warning [-Wmissing-prototypes]Karel Zak2012-07-161-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify file open error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: move hwclock to sys-utils/Karel Zak2012-06-261-0/+677
Signed-off-by: Karel Zak <kzak@redhat.com>