summaryrefslogtreecommitdiffstats
path: root/sys-utils
Commit message (Collapse)AuthorAgeFilesLines
* rtcwake: add rtcwake_control and remove global variablesSami Kerola2015-06-291-62/+69
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* zramctl: add link to kernel documentationSami Kerola2015-06-291-0/+4
| | | | | | The manual page does lacks explanation how to create zram with modprobe. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sys-utils/disk-utils/lib: fix printf format types [cppcheck]Boris Egorov2015-06-254-28/+28
| | | | | | Fix 'invalidPrintfArgType' cppcheck warnings Signed-off-by: Boris Egorov <egorov@linux.com>
* fstrim: de-duplicate by mount source tooKarel Zak2015-06-101-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now fstrim de-duplicates by target (mountpoint). This patch adds de-duplication according to mount source (device) to avoid bind mounts or devices mounted more than once. Note that the patch also check FS root, the different FS roots of the same multi-root FS (e.g. btrfs) maybe mounted on different places. # mount --bind /home/wine /mnt/test old version: # fstrim -av /mnt/test: 0 B (0 bytes) trimmed <--- /home/wine: 0 B (0 bytes) trimmed <--- /boot: 0 B (0 bytes) trimmed /home: 0 B (0 bytes) trimmed /: 0 B (0 bytes) trimmed new version: # fstrim -av /mnt/test: 0 B (0 bytes) trimmed <--- /boot: 0 B (0 bytes) trimmed /home: 171.8 MiB (180113408 bytes) trimmed /: 0 B (0 bytes) trimmed Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1162213 Signed-off-by: Karel Zak <kzak@redhat.com>
* man: fix nolazytime typo in mount(8)Andreas Henriksson2015-06-081-1/+1
| | | | | | | | Avoids double negation... Addresses: http://bugs.debian.org/786554 Reported-by: Felix Zielcke <fzielcke@z-51.de> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* losetup: add --jsonKarel Zak2015-06-052-2/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: print more usable error message on failed -fKarel Zak2015-06-031-2/+11
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1215370 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: do not call umount helper on --fakeKarel Zak2015-06-031-2/+3
| | | | | | | | | The umount.<type> helpers does not support --fake option and it does not make sense to call the helpers at all. All we need is to remove mtab/utab entries. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1172297 Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: add warning for __SANITIZE_ADDRESS__Karel Zak2015-06-021-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sys-utils: lscpu segfaults when built with -fsanitize=addressCristian Rodríguez2015-06-021-1/+1
| | | | | This is expected and a false positive, exclude the vmware detection trick when __SANITIZE_ADDRESS__ is defined.
* hwclock: don't allow non-root accessKarel Zak2015-05-262-44/+5Star
| | | | | | | | | | | | | | | Fortunately very few people are crazy enough to install hwclock as setuid. Some comments in code and unfortunately also man page advertising that setuid is no problem. That's pretty stupid promise. The code quality is poor and it's obviously not designed to be secure (things like popen() without drop privileges, etc.). This patch removes all notes about "setuid support" and for sure disable hwclock execution for non-root users. Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=786804 Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: support unshare.staticGeorg Schiesser2015-05-181-0/+8
| | | | | | | | | | This patch adds support for building a static version of unshare. We need to add unshare to the list of possible static programs, and provide build flags for the compiler and linker, which are equivalent to the flags of the non-static program, except additional static linking. See also: commit 2fa60c5 build-sys: support nsenter.static Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
* zramctl: add MEM-LIMIT, MEM-USED and MIGRATED columnsKarel Zak2015-05-181-7/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: support /sys/block/zram<id>/mm_statKarel Zak2015-05-181-13/+78
| | | | | | Linux >= 4.1 provides all memory related statistics by one file. Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: add cpu flags entry to summary outputWANG Chao2015-05-131-0/+3
| | | | | | | It'd be convenient to have unified cpu "Flags: " entry in the summary output. Signed-off-by: WANG Chao <wcwxyz@gmail.com>
* flock: NULL derefBrad Forschinger2015-05-051-1/+1
| | | | | | | cmd_argv[2] will be initialised only if it's specificed with -c. NULL deref otherwise resulting in crash. Signed-off-by: Brad Forschinger <bnjf@bnjf.id.au>
* build-sys: fix parallel builds w/setarch linksMike Frysinger2015-05-051-0/+1
| | | | | | | | | | | | | | The symlink generation tries to write to the sys-utils/ subdir but does not make sure that dir exists. This can sometimes lead to parallel build failures when building out-of-tree like: ... echo ".so man8/setarch.8" > sys-utils/linux64.8 /bin/bash: sys-utils/linux64.8: No such file or directory Makefile:11503: recipe for target 'sys-utils/linux64.8' failed make: *** [sys-utils/linux64.8] Error 1 References: https://bugs.gentoo.org/511812 Signed-off-by: Mike Frysinger <vapier@chromium.org>
* hwclock: fix spelling, punctuation and formatting mistakes in the man pageBenno Schulenberg2015-04-281-40/+38Star
| | | | | | Also improve some wordings. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* hwclock: clean up man page headerKarel Zak2015-04-281-17/+3Star
| | | | | | | | | | We already use .TQ in another man pages for years and nobody complains, so I guess the fallback is unnecessary. The patch also minimize in-header change-log. We have git for this purpose. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove an untrue phrase from the man pageBenno Schulenberg2015-04-281-5/+0Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* swapon: search for mkswap via PATHMike Frysinger2015-04-272-5/+3Star
| | | | | | | | Rather than hardcode /sbin/mkswap all the time, use a normal PATH search. This matches the normal behavior of other tools, and makes local testing easier. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* hwclock: flush stdout in hwclock -cAlexey Galakhov2015-04-271-0/+1
| | | | | | | | This allows using hwclock -c in automated test scripts that parse its output line-by-line. The standard output is flushed before each 10 second delay. Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
* hwclock: Remove TZUTCJ William Piggott2015-04-271-9/+2Star
| | | | | | | | | | | | | | | | | | | | | commit d53f8ecfbf036eddb2aef737dc0973a613d80ced introduced the TZUTC environment variable to facilitate use of the zoneinfo 'right' database. This was incorrect. Either the TZDIR environment variable should be used or a system-wide configuration for the 'right' database should be used. See hwclock(8) POSIX vs 'RIGHT' for more details. TZUTC was undocumented and should be safe to remove. The commit also caused a regression when using musl libc, because when TZUTC is unset getenv() returns a NULL pointer. Reported-by: Isaac Dunham <ibid.ag@gmail.com> Signed-off-by: J William Piggott <elseifthen@gmx.com>
* lib/strutils: fix string_add_to_idarray() int vs. size_tKarel Zak2015-04-221-4/+6
| | | | | | | | | | | | | | | | | | | | The function uses "int" as argument, but for array size (and index) is better to use unsigned type (size_t). If we mix "size_t" in util (e.g. fdisk) and "int" in lib/strutils.c then result is unexpected behavior on ppc64. # sfdisk --list -o DEVICE,START,SIZE /dev/sdb Disk /dev/sdb: 50 MiB, 52428800 bytes, 102400 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 32768 bytes Disklabel type: gpt Disk identifier: 3B8559DB-33AF-43E9-BEFC-C331D829B539 lt-sfdisk: libfdisk/src/label.c:178: fdisk_label_get_field: Assertion `id > 0' failed. The patch cleanup all code to use size_t everywhere. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove dead codeJ William Piggott2015-04-211-14/+0Star
| | | | | | | Removes never used #ifdef dead code. Reported-by: Karel Zak <kzak@redhat.com> Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: regression fixJ William Piggott2015-04-211-4/+5
| | | | | | | | | | Commit ab8f402952301106ad0bd5c5a51dc8646d1bff64 regression where synchronize_to_clock_tick_rtc() only returns the correct value for a select() time out if using debug mode. This caused hwclock to have invalid output when select() timed out in normal mode. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* unshare: allow persisting mount namespacesKarel Zak2015-04-141-4/+68
| | | | | | | | | | | | | | | | We can create a reference (bind mount) to the new namespace after unshare(2), but it does not make sense to do it within unshared namespace. (And if I read kernel fs/namespace.c: do_loopback() correctly than copy mount bind mounts of /proc/<pid>/ns/mnt between namespaces is unsupported.) This patch bypass this problem by fork() where parent continue as usually (call unshare(2), setup another things, etc.), but child waits for /proc/[ppid]/ns/mnt inode number change (the ino is changed after parent's unshare(2)) and then it bind mounts the new namespaces and exit. Signed-off-by: Karel Zak <kzak@redhat.com>
* unshare: allow persisting namespacesKarel Zak2015-04-142-31/+132
| | | | | | | | | | | | | | | | | | | | | | | For nsenter(1) we already support namespace specification by file (e.g. bind mount to namespace /proc/[pid]/ns/[type] file). For example: # nsenter --uts=/some/path This patch extends unshare(1) to setup the bind mount for specified namespace, for example # touch /some/path # unshare --uts=/some/path hostname FOO # nsenter --uts=/some/path hostname FOO Note that the problem is mount namespace, because create bind mount to ns/mount file within unshared namespace does not make sense. Based on patch from Lubomir Rintel <lkundrak@v3.sk>. Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: fix lazytime docsKarel Zak2015-03-301-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add support for MS_LAZYTIMEKarel Zak2015-03-301-0/+27
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setarch: fix regression for sparc buildsWaldemar Brodkorb2015-03-301-1/+1
| | | | | | | | | With following commit: 5edb0ea6bbd57dd916417737f98c9109dc1ecb5b Sparc cross-compile fails. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
* dmesg: use GMT in tests, add DMESG_TEST_BOOTIMEKarel Zak2015-03-231-7/+19
| | | | | | | We don't want to hardcode anything to the test, just use env.variable DMESG_TEST_BOOTIME. Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add test_dmesg that has fixed boot timeSami Kerola2015-03-232-0/+9
| | | | | | This allows testing time stamp formats. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: fix shadow declarationSami Kerola2015-03-231-8/+3Star
| | | | | | | | | | | sys-utils/dmesg.c:650:9: warning: declaration of 's' shadows a previous local [-Wshadow] sys-utils/dmesg.c:619:12: warning: shadowed declaration is here [-Wshadow] And since the code had to be touched deprecate loop printing one character at a time, in favour of printf and instruction to repeat spaces the number required. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* unshare: add --propagation, use MS_PRIVATE by defaultKarel Zak2015-03-232-6/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | After "unshare --mount" users assume that mount operations within the new namespaces are unshared (invisible for the rest of the system). Unfortunately, this is not true and the behavior depends on the current mount propagation setting. The kernel default is "private", but for example systemd based distros use "shared". The solution is to use (for example) "mount --make-private" after unshare(1). I have been requested many times to provide less fragile and more unified unshared mount setting *by default* to make things user friendly. The patch forces unshare(1) to explicitly use MS_REC|MS_PRIVATE for all tree by default. We can use something less (e.g MS_SLAVE), but "private" is the kernel default, so for many users this change (feature) will be invisible. This feature is possible to disable by "--propagation unchanged" or it's possible to specify another propagation flag, supported are: <slave|shared|private|unchanged> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* nsenter: add -Z to set selinux contextKarel Zak2015-03-203-5/+46
| | | | | | | | The new context is copied from --target <PID>. This solution allows to keep SELinux happy when you enter container by nsenter(1). Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1116100 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: don't remount read-only on --bindKarel Zak2015-03-201-0/+3
| | | | | | | | mount(8) tries to mount read-only when the previous attempt ends with EROFS or EACCES. This is bad idea for bind mounts as "ro,bind" has a special semantic. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: non-root access in test modeJ William Piggott2015-03-171-3/+3
| | | | | | | Allow a non-root user to call all hwclock functions when the --test option is used. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: increase debug output precisionJ William Piggott2015-03-171-2/+2
| | | | | | | | | | Increased the precision in debug output showing the clock drift and the time lapsed. Showing a clock drift of 0.0 while giving a value that the drift factor was adjusted by makes no sense. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: cosmetic changes to man pageKarel Zak2015-03-171-7/+8
| | | | | Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: man-page errataJ William Piggott2015-03-131-22/+0Star
| | | | | | | | | | The information I wrote regarding clock crystals was not only incomplete, it was wrong. The characteristics of quartz crystals is beyond the scope of this man-page. It was misguided to attempt to include it. This commit removes said information. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: add '11 minute mode' informationJ William Piggott2015-03-131-10/+15
| | | | | | | | Add that '11 minute mode' is a kernel compile time option. Add details regarding its activation and how to check its status. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: remove depreciated ntpdateJ William Piggott2015-03-131-2/+2
| | | | | | Replace references to the depreciated ntpdate with sntp. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: Improve FILES sectionJ William Piggott2015-03-131-5/+11
| | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: add TZDIRJ William Piggott2015-03-131-5/+12
| | | | | | | Add information about TZDIR and improve the ENVIRONMENT section. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* build-sys: cleanup realtime lib usageKarel Zak2015-03-061-3/+3
| | | | | | | | * check for timer_create() * define dependence on timer_create() for flock * rename CLOCKGETTIME_LIBS to REALTIME_LIBS Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/timer: use separate file for timersKarel Zak2015-03-062-1/+2
| | | | | | | | It seems that static builds require -lpthread for timer_* functions. It's better to keep it out of our libs (e.g. libmount) to avoid unnecessary dependence. Signed-off-by: Karel Zak <kzak@redhat.com>
* tunelp: use parse_switch()Sami Kerola2015-03-051-16/+5Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* flock: improve timeout handlingSami Kerola2015-03-052-8/+11
| | | | | | | | | | | | Signal ALRM raised by the timer, and the timer only, will be considered as a timeout criteria. Secondly time interval is made to use monotonic clock. Documentation of ITIMER_REAL is unclear whether that time is affected various sources of clock skew, or does it even tick when system is suspended. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* flock: add --verbose optionSami Kerola2015-03-033-4/+35
| | | | | | | | | Jenkins script jobs using flock are a great example of a situation in which one may want an automation to be verbose, so that when unexpected events happen there is more hints in logs. Reviewed-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>