summaryrefslogtreecommitdiffstats
path: root/sys-utils
Commit message (Collapse)AuthorAgeFilesLines
* hwclock: make debug implicit for test mode.J William Piggott2017-09-212-5/+6
| | | | | | | Calling --test without --debug is not useful, so make it implicit. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: exit bug fix and single test mode messageJ William Piggott2017-09-211-38/+23Star
| | | | | | | | Bug fix: hwclock returns success when saving /etc/adjtime fails. Remove redundant test mode messages. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* docs: remove repeated word from mount(8) man pageSami Kerola2017-09-181-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: cleanup UUID_STR_LEN definitionsKarel Zak2017-09-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: fix coding style and error messagesKarel Zak2017-09-151-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: do not fsync(3) /dev/rfkill file descriptorSami Kerola2017-09-151-1/+1
| | | | | | | | 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>
* rfkill: allow use of multiple argumentsSami Kerola2017-09-152-35/+56
| | | | | | | | | | | | | | | | 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>
* hwclock: add -a that is short of --adjust to manual page and usageSami Kerola2017-09-052-3/+3
| | | | | | In same go use -V as return value of --version from getopts_long(). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* hwclock: update usage()J William Piggott2017-09-051-1/+1
| | | | | | Improve usage strings for debug and version. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* Merge branch '170825' of github.com:jwpi/util-linuxKarel Zak2017-09-053-52/+37Star
|\ | | | | | | | | | | | | * '170825' of github.com:jwpi/util-linux: hwclock: close hwaudit_fd unconditionally hwclock: don't always use hwclock_exit hwclock: remove sysexits.h
| * hwclock: close hwaudit_fd unconditionallyJ William Piggott2017-09-031-1/+1
| | | | | | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
| * hwclock: don't always use hwclock_exitJ William Piggott2017-09-031-7/+7
| | | | | | | | | | | | | | | | 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>
| * hwclock: remove sysexits.hJ William Piggott2017-09-033-48/+33Star
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | misc: replace magic number 37 with UUID_STR_LENPhilip Prindeville2017-09-051-1/+5
|/ | | | Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* rfkill: add NFC fallback for old headersKarel Zak2017-08-311-0/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: cleanup returnsKarel Zak2017-08-311-20/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove unused rfkill.pyKarel Zak2017-08-311-150/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: add Sami to authorsKarel Zak2017-08-312-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: cleanup usage()Karel Zak2017-08-311-5/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: add systemd-rfkill(8) see also segmentSami Kerola2017-08-301-1/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: check id number refers to a device that existsSami Kerola2017-08-301-1/+8
| | | | | | | | | | | | | | | | 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>
* rfkill: use back and forward compatible testSami Kerola2017-08-301-4/+4
| | | | | | | | 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>
* rfkill: inform in syslog when rfkill is invokedSami Kerola2017-08-301-0/+10
| | | | | | | | | 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>
* rfkill: use human readable timestamps in event outputSami Kerola2017-08-301-4/+11
| | | | | | | The event command appears to be something what primarily a developers will to use when debugging. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: use libsmartcols outputSami Kerola2017-08-303-87/+233
| | | | | | | 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>
* rfkill: do not ignore read errorSami Kerola2017-08-301-1/+5
| | | | | | | | 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>
* rfkill: clarify 'all devices' handlingSami Kerola2017-08-301-21/+22
| | | | | | | | 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>
* rfkill: update manual pageSami Kerola2017-08-301-19/+63
| | | | | | Make the manual page style to match with util-linux project. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: make programming style to match util-linux projectSami Kerola2017-08-302-119/+143
| | | | | | | | 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>
* rfkill: make command to build in util-linux projectSami Kerola2017-08-302-4/+13
| | | | | | | 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>
* rfkill: move files to appropriate locationsSami Kerola2017-08-303-0/+561
| | | | | | | 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>
* hwclock: remove bool type definitionSami Kerola2017-08-303-27/+24Star
| | | | | | | | | 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: for debugging print startup system timeJ William Piggott2017-08-251-1/+4
| | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: refactor set_system_clock()J William Piggott2017-08-251-11/+6Star
| | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: update set_system_clock commentsJ William Piggott2017-08-251-15/+27
| | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: update set_system_clock debuggingJ William Piggott2017-08-251-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* hwclock: remove set_system_clock_timezone()J William Piggott2017-08-251-89/+0Star
| | | | | | | 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>
* hwclock: move systz into hctosysJ William Piggott2017-08-251-3/+9
| | | | | | | | | | | | | | | | 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>
* dmesg: fix delimiter calculationKarel Zak2017-08-161-1/+1
| | | | | Reported-by: Laszlo Varkonyi <vlsoftsystems@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: add info about lazy detach to manpageKarel Zak2017-08-101-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: fix hclock_valid test and error messagesJ William Piggott2017-08-041-94/+53Star
| | | | | | | | | | | | | 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>
* hwclock: remove busywait tristate return statusJ William Piggott2017-08-042-12/+5Star
| | | | | | | | | 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: restore select() timeout warningJ William Piggott2017-08-041-3/+2Star
| | | | | | | | | | | 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>
* hwclock: update man pageJ William Piggott2017-08-041-6/+20
| | | | | | | | | | 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>
* hwclock: correlate hclocktime instead of set_time.J William Piggott2017-08-041-9/+13
| | | | | | | | | | 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>
* hwclock: fix RTC read logicJ William Piggott2017-08-041-23/+15Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* hwclock: move drift correction and --predictJ William Piggott2017-08-041-26/+31
| | | | | | | | | | | | 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>
* hwclock: move rtc permissions testJ William Piggott2017-08-041-3/+3
| | | | | | | Move the rtc permissions test below the systz call and simplify it's 'if' test. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: move systz above init clocks readJ William Piggott2017-08-041-3/+4
| | | | | | | 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>
* setpriv: document accepted formats for naming capsPatrick Steinhardt2017-08-011-1/+6
| | | | | | | | | | | | 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>