summaryrefslogtreecommitdiffstats
path: root/sys-utils
Commit message (Collapse)AuthorAgeFilesLines
* wdctl: remove duplicate include of <unistd.h>Patrick Steinhardt2019-08-191-1/+0Star
| | | | | | | The <unistd.h> header is included twice in "wdctl.c". Remove one of these includes to keep "make checkincludes" happy. Signed-off-by: Patrick Steinhardt <ps@pks.im>
* Merge branch 'issue832' of https://github.com/kerolasa/util-linuxKarel Zak2019-08-072-4/+22
|\ | | | | | | | | * 'issue832' of https://github.com/kerolasa/util-linux: mountpoint: add --nofollow option
| * mountpoint: add --nofollow optionSami Kerola2019-08-022-4/+22
| | | | | | | | | | | | | | | | | | | | The no follow option will allow user to distinct mount points from symbolic links pointing to them. Arguably this is pretty pedantic option, mounting a device or bind mount to a directory via symlink does not have or cause any issues. Addresses: https://github.com/karelzak/util-linux/issues/832 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | removed double spaceChistyj Arkadij2019-08-041-1/+1
| |
* | fixed mount man page typo, "bythe" -> "by the"Chistyj Arkadij2019-08-041-1/+1
|/
* dmesg: fix output hex encodingKarel Zak2019-08-011-11/+15
| | | | | | | The current code ignores single-byte non-printable characters. Reported-by: Marc Deslauriers <marc.deslauriers@canonical.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* choom: improve docsKarel Zak2019-08-012-1/+2
| | | | | | | | It's not obvious from the current docs that you have to explicitly split command line options and wanted commands. Addresses: https://github.com/karelzak/util-linux/issues/833 Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: prefer memcpy() to manual pointer arithmeticSami Kerola2019-07-271-1/+1
| | | | | | | | | | | With pointer arithmetic clang address sanitizer gives following error this change addresses. Notice the following happens only when running as root. sys-utils/lscpu-dmi.c:83:14: runtime error: load of misaligned address 0x55a1d62f3d1d for type 'const uint16_t' (aka 'const unsigned short'), which requires 2 byte alignment Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lscpu: (man) add note about cache sizesKarel Zak2019-07-251-0/+5
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/827 Signed-off-by: Karel Zak <kzak@redhat.com>
* fstrim: fix systemd service protectionKarel Zak2019-07-221-1/+1
| | | | | | | | ProtectHome=yes makes /home inaccessible, but we need to open the directories (mountpoints) read-only. Addresses: https://github.com/karelzak/util-linux/issues/824 Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: use CMOS clock only if availableCarlos Santos2019-07-153-43/+13Star
| | | | | | | | | | | | - 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>
* losetup: Typo fixStanislav Brabec2019-06-211-1/+1
| | | | | | Fix a typo in usage introduced in a1a41597bf. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* Merge branch 'topic/wdctl'Karel Zak2019-06-172-81/+189
|\
| * wdctl; read from /sys if necessaryKarel Zak2019-06-172-9/+76
| | | | | | | | | | | | | | | | | | | | | | | | The device can be inaccessible for non-root user or busy (already used by another process). In this case it seems better to read information from /sys. Note that /sys does not provide struct watchdog_info.options, so we cannot print list of supported watchdog features. Addresses: https://github.com/karelzak/util-linux/issues/804 Signed-off-by: Karel Zak <kzak@redhat.com>
| * wdctl: default to /dev/watchdog0Karel Zak2019-06-171-7/+36
| | | | | | | | | | | | | | Let's use miscdev /dev/watchdog as fallback only. We need (if possible) cdev /dev/watchdog0 as this device has entry in /sys/class/watchdog. Signed-off-by: Karel Zak <kzak@redhat.com>
| * wdctl: remove printing from main()Karel Zak2019-06-171-27/+35
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
| * wdctl: add control structKarel Zak2019-06-171-27/+31
| | | | | | | | | | | | | | * remove global variables * keep all together Signed-off-by: Karel Zak <kzak@redhat.com>
| * wdctl: rename watch dog info structKarel Zak2019-06-171-27/+27
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | misc: replaces atexit(close_stdout) with new close_stdout_atexit()Karel Zak2019-06-175-5/+5
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lscpu: add a new columns to --cacheKarel Zak2019-06-172-6/+57
|/ | | | | References: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu Signed-off-by: Karel Zak <kzak@redhat.com>
* fstrim: update man page, reuse libmnt_iterKarel Zak2019-06-112-11/+10Star
| | | | | | | | * add info about read-only to the man page * don't be systemd specific, people aso use crond * reuse libmnt_iter Signed-off-by: Karel Zak <kzak@redhat.com>
* fstrim: properly de-duplicate fstrim -AStanislav Brabec2019-06-111-13/+30
| | | | | | | | | | fstab can contain tag based mounts. De-duplication by source has to be done after resolving the full source path. Perform the table iteration twice. First time, prepare for de-duplication, second time perform the TRIM itself. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* fstrim -a/-A: Skip read-only volumesStanislav Brabec2019-06-111-0/+8
| | | | | | | | | | | Calling TRIM on some read-only volumes can fail with: fstrim: /win: FITRIM ioctl failed: Bad file descriptor Skipping all read-only mounts seems to be safe and logical strategy. Fixes opensuse#1106214. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* fstrim: Fix fstrim_all() commentStanislav Brabec2019-06-111-1/+1
| | | | | | | | "convert LABEL=" does not happens in mnt_fs_get_source(), but later in mnt_resolve_spec(). To make this more clean, move the comment before this chunk of code. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* umount: be more strict about --allKarel Zak2019-06-061-0/+4
| | | | | | | | | | | | If you by accident execute umount ls -al /mnt/ then umount --all is executed and another arguments silently ignored. It seems better to be more strict in this case. Reported-by: Harald Dunkel <harald.dunkel@aixigo.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* setpriv: fix memory leak in local scope [coverity scan]Karel Zak2019-05-281-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setarch: avoid NULL dereference [coverity check]Karel Zak2019-05-281-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rtcwake: terminate mode and excl[]Karel Zak2019-05-281-1/+5
| | | | | | | * terminate string read from /proc * terminate array for exclusive options Signed-off-by: Karel Zak <kzak@redhat.com>
* renice: make code more readable for static analyzer [coverity scan]Karel Zak2019-05-281-1/+1
| | | | | | | It seems coverity and clag have no clue about relation between argv[] and argc. Let's make code more readable for them... Signed-off-by: Karel Zak <kzak@redhat.com>
* readprofile: be more explicit with used types [cppcheck]Karel Zak2019-05-281-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: check scols_line_set_data() return value [coverity scan]Karel Zak2019-05-281-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: make lookup() use more consistent [coverity scan]Karel Zak2019-05-281-2/+4
| | | | | | | We usually check lookup() return value. Let's do it in this case too. It seems static analyzers will be happy with consistent code. Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: check return value when read from /proc [coverity scan]Karel Zak2019-05-231-3/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: don't use uninitialized value [coverity scan]Karel Zak2019-05-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fallocate: make posix_fadvise() use more readable for analyzersKarel Zak2019-05-231-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: make strtok() use more robustKarel Zak2019-05-231-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkzone: remove never read valueKarel Zak2019-05-231-3/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: use xstrncpy()Karel Zak2019-05-201-4/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2019wk19' of https://github.com/kerolasa/util-linuxKarel Zak2019-05-201-8/+12
|\ | | | | | | | | | | | | | | | | | | | | * '2019wk19' of https://github.com/kerolasa/util-linux: lib/colors: remove redundant if statement wipefs: fix variable / function shadowing [cppcheck] sulogin: fix variable / function shadowing [cppcheck] lscpu: remove redundant condition check [cppcheck] libmount: avoid possible null pointer dereference [cppcheck] lib/mangle: fix possible null pointer dereference [cppcheck] sfdisk: remove unnecessary size check [cppcheck]
| * lscpu: remove redundant condition check [cppcheck]Sami Kerola2019-05-181-8/+12
| | | | | | | | | | | | | | | | | | [sys-utils/lscpu.c:1783] -> [sys-utils/lscpu.c:1785]: (warning) Either the condition 'desc' is redundant or there is possible null pointer dereference: desc. [sys-utils/lscpu.c:1840] -> [sys-utils/lscpu.c:1842]: (warning) Either the condition 'desc' is redundant or there is possible null pointer dereference: desc. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | Merge branch 'lscpu_midr_updates' of https://github.com/jlinton/util-linuxKarel Zak2019-05-201-0/+3
|\ \ | | | | | | | | | | | | * 'lscpu_midr_updates' of https://github.com/jlinton/util-linux: lscpu: Add additional aarch64 models
| * | lscpu: Add additional aarch64 modelsJeremy Linton2019-05-161-0/+3
| |/ | | | | | | | | | | | | | | ARM has released docs for Cortex-A76, Neoverse-N1 and Neoverse-E1. That means we know the midr partnums, so we can add them to the human readable model name table. Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
* | lscpu: fix floating point exceptionSami Kerola2019-05-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | As the title tells this change indeed fixes floating point exception, but post processing as value overwrite feels a wrong. Possibly something in input is making cpu set count to go wrong, but I could not get my head around what could it be. Anyway avoiding division by zero seems better than crashing so lets do this atleast for now. Caused-by: e5f721132ec8b8c933a396d8dcb3efcb67854f13 Addresses: https://github.com/karelzak/util-linux/issues/788 Reported-by: Lars Wendler <polynomial-c@gentoo.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | lscpu: remove extra space from field key nameSami Kerola2019-05-161-3/+3
|/ | | | | | | | | | | | | | | | | | | The extra space was more obvious in json output. But as the expected test output displays also the standard output can be effected by this change. $ lscpu --json | jq '.lscpu | .[].field' | grep ': ' "L1d cache: " "L1i cache: " "L2 cache: " "L3 cache: " "Vulnerability L1tf: " "Vulnerability Mds: " "Vulnerability Meltdown: " "Vulnerability Spec store bypass: " "Vulnerability Spectre v1: " "Vulnerability Spectre v2: " Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rtcwake: fix "maybe be" duplicationAustin English2019-05-151-2/+2
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* mount: fix "maybe be" duplicationAustin English2019-05-151-4/+4
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* fstrim: affect only warnings by --quietKarel Zak2019-05-091-6/+7
| | | | | | | | We need the same return code from fstrim_filesystem() independently on --quiet command line option. Addresses: https://github.com/karelzak/util-linux/pull/791 Signed-off-by: Karel Zak <kzak@redhat.com>
* fstrim: add --quiet option to suppress error messagesSami Kerola2019-05-073-6/+31
| | | | | | | | | | | | | When fstrim interacts with NTFS it result can be error reporting bad file descriptor. That seems to be a bug in NTFS. While waiting driver to get on top of the issue and be commonly available lets add to fstrim option to make it be more silent about errno 9 aka EBADF, Bad file descriptor. Reported-by: https://github.com/moviuro Proposed-by: Dave Reisner <dreisner@archlinux.org> Reference: https://bugs.archlinux.org/task/62288 Addresses: https://github.com/karelzak/util-linux/issues/789 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* losetup: man page has repeating words [make checkmans]Karel Zak2019-04-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fstrim: document kernel return minlen explicitlyWang Shilong2019-04-241-4/+5
| | | | | | | | | | Filesystem will modify @minlen according to its block size etc, and will return actual unit to userspace, document it into manpage. Cc: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Wang Shilong <wshilong@ddn.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>