- 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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
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>
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>