| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Calling --test without --debug is not useful, so
make it implicit.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
| |
Bug fix: hwclock returns success when saving /etc/adjtime fails.
Remove redundant test mode messages.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
| |
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
| |
Attempt to fsync() this device returns EINVAL, causing the rfkill always to
return EXIT_FAILURE when either block or unblock is requested. Simply
closing the file descriptor will fix the issue.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no reason why multiple arguments could not be supported.
Most common use case is to do multiple control commands in one go without us
of 'all' argument that can cause unnecessary connection breakage. For
example someone might want to add to a system initialization following
commands.
rfkill block bluetooth uwb wimax wwan gps fm nfc
That will ensure everything but wifi is turned off with as few commands as
possible, without killing wifi at any point.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
| |
In same go use -V as return value of --version from getopts_long().
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
| |
Improve usage strings for debug and version.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|\
| |
| |
| |
| |
| |
| | |
* '170825' of github.com:jwpi/util-linux:
hwclock: close hwaudit_fd unconditionally
hwclock: don't always use hwclock_exit
hwclock: remove sysexits.h
|
| |
| |
| |
| | |
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Special exit handling is not wanted for usage() or bad
command syntax. For example we do not want to audit:
hwclock --set --date foo
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
sysexits.h was introduced in v2.11t prior to util-linux-ng, with the
HISTORY entry: * hwclock: minor polishing.
So there was no specific issue solved by adding it. Its use was never
documented so it should be safe to remove.
Also, fix return values being used for the exit status that were not
magic constants (portability issue).
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|/
|
|
| |
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Earlier all commands happily accepted without detecting failure when
none-existing id number was used. For example:
$ rfkill block 2017; echo $?
0
The same input after this change looks following.
$ rfkill block 2017; echo $?
rfkill: invalid identifier: 2017
1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
| |
The rfkill_event struct might grow in future, so ensure the read sizes are
at least the minimum, and allow it to be more.
Reference: https://github.com/torvalds/linux/blob/master/include/uapi/linux/rfkill.h#L90-L102
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
| |
This should help when trying to explain what or who is flicking wireles on
or off. Notice that the change is not perfect - if rfkill command is
setting a state that is already set the syslog entry is sent eventhough
there was no effective change.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
| |
The event command appears to be something what primarily a developers will
to use when debugging.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
| |
This also makes the rfkill to output status when executed without arguments.
That is believed ot be more useful than usage() output.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
| |
Read error should be impossible, but when one does happen user certainly
wants to know about that rather than see even more strange issue caused
random data in name variable.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
| |
Stop using RFKILL_IS_INVALID a marker when rfkill is iterating over all
devices. Addition of RFKIL_IS_ALL should make this a lot easier to digest,
especially if reading code in hurry.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
| |
Make the manual page style to match with util-linux project.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
| |
Use the usual facilities, add translation strings, move global variables at
the beginning of the file, make usage() look as expected, add standard
command-line option parsing.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
| |
After this commit the command merely builds, but does not confirm style used
in util-linux project.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
| |
Also remove unnecessary items. Notice that the licence text from COPYING is
moved to top of the command in comment section.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
| |
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
| |
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update debug messages for a combined --systz and --hctosys in
the set_system_clock function.
New debug messages:
hwclock --test -D --systz --localtime
Calling settimeofday(NULL, 240) to warp System time.
Test mode: clock was not changed
hwclock --test -D --systz --utc
Calling settimeofday(NULL, 0) to lock the warp function.
Calling settimeofday(NULL, 240) to set the kernel timezone.
Test mode: clock was not changed
hwclock --test -D --hctosys --utc
Calling settimeofday(1502239269.733639, 240)
Test mode: clock was not changed
hwclock --test -D --hctosys --localtime
Calling settimeofday(NULL, 240) to set persistent_clock_is_local.
Calling settimeofday(1502253708.200200, 240)
Test mode: clock was not changed
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
| |
Remove set_system_clock_timezone() because the previous patch
moved its functionality into set_system_clock().
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The set_system_clock_timezone() function is nearly identical to
set_system_clock(). Three additional statements are required
to include systz in hctosys.
This patch is intentionally incomplete to make reviewing the
actual required changes easier. Other patches in this set will:
* remove set_system_clock_timezone()
* fix messages and debugging
* fix comments
* and finally refactor set_system_clock()
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
| |
Reported-by: Laszlo Varkonyi <vlsoftsystems@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Every hwclock operation that requires reading the RTC, tests
hclock_valid and prints a different warning. This redundancy
is unnecessary.
Move the warning to the RTC read block (the test was moved in
a previous patch in this set). This reduces function arguments
and is a significant code clean up. It will also benefit the
translators.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
| |
The select() synchronization branch only returns success or
fail. There is no reason for the busywait branch to do more.
If synchronization fails for any reason then it must exit,
otherwise all drift correction operation will be invalid.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
| |
hwclock now exits on select(2) timeout so restore the warning.
Reverts commit ab8f402952301106ad0bd5c5a51dc8646d1bff64
and commit efc4eaf4229f78f14430d8739ddef2c5101f05cc
Except use warnx(), because select() timeout does not set errno.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
| |
Add information about setting the Hardware Clock if it has been
corrupted.
Add information about --update-drift and reduced system shutdown
times for --systohc.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
| |
Correlate hclocktime with set_time instead of the other way around,
because set_time is used for timestamps in the adjtime file so it needs
to be unadulterated.
Also create var startup_hclocktime for correlated time.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Over the past decade a few commits for a corner case problem
have left the RTC read branch in a bad place.
The problem was: when a corrupted RTC could not be read, then
it also could not be reset, because hwclock would error out
due to the RTC read failure.
2.15-rc1 commit 3b96a7a Aug 9 2008
2.19-rc1 commit 5606df5 Dec 29 2010
2.23-rc1 commit ab8f402 Mar 21 2013
The first fix was to ignore a synchronization timeout only for
the busywait branch.
Two and a half years later a commit describing the same problem
took a little more heavy-handed approach by ignoring all
synchronization failures and the RTC read after it, for both of
the RTC set functions.
Because the previous fix also ignored the select() branch timeout
it caused a bogus warning. The chosen workaround for that was to
only print the select() timeout message in debug mode (this is
reverted by another patch).
The problem with these fixes is that we cannot just ignore the
synchronization timeout like that, because then the drift
correction operations will be invalid. The original logic was
correct; we must exit when synchronization fails.
Another problem is that now there are statements between the
timing-critical synchronize-read-timestamp trio (which were
also in the wrong order, but that part of the problem goes
back further in history).
The solution is to skip the RTC read block completely for the
RTC set functions when not also using the --update-drift
option. If we are updating the drift correction factor during
a set function then we must synchronize and read the RTC.
Otherwise reading the RTC is not needed. Anyone trying to set
a corrupt RTC should not be using --update-drift, because the
resulting drift correction factor would be invalid.
Using this approach has the added benefit of significantly
reducing system shutdown time when not using --update-drift:
time ./hwclock --test --systohc; time ./hwclock-master --test --systohc
Test mode: clock was not changed
real 0m0.072s
user 0m0.066s
sys 0m0.003s
Test mode: clock was not changed
real 0m1.000s
user 0m0.169s
sys 0m0.005s
I've see differences as high as 1.518 seconds.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the predict branch above the RTC read branch.
Move drift correction into the RTC read branch, because it
requires an accurate RTC read, and it needs to be skipped for
operations that do not require an RTC read.
Simplify the RTC read branch test.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
| |
Move the rtc permissions test below the systz call and
simplify it's 'if' test.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
| |
The systz option is all about speed, so move it to the
top and simplify the init clocks read test.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since commit fbd15c4d4 (setpriv: support setting unnamed capabilities,
2017-07-17), it is possible to name capabilities not only by name, but
also by their index. While using the human-readable name is usually
recommended, using the index may be required in case new capabilities
have been introduced to the kernel for which we have no name yet. The
newly introduce format format is not documented inside of setpriv(1),
though, which is being fixed in this commit.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|