summaryrefslogtreecommitdiffstats
path: root/sys-utils
Commit message (Collapse)AuthorAgeFilesLines
...
* umount: provide more helpful error messageKarel Zak2013-09-271-0/+6
| | | | | | | | | | | | | | | non-root user on device that is not mounted: $ umount /mnt/flash umount: /mnt/flash: umount failed: Operation not permitted this is true, because we cannot evaluate permissions as there is no entry in mtab, but users expect something more helpful -- for example umount: /mnt/flash: not mounted References: https://bugs.archlinux.org/task/31647 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add notes about UUIDs to the man pageKarel Zak2013-09-262-3/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: fix repeating words in the man pageKarel Zak2013-09-261-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: report cpu min mhzDavidlohr Bueso2013-09-251-13/+37
| | | | | | | | The lscpu tool only shows the current and max CPU frequencies, however, in many scenarios this is not enough. If there are energy saving situations (like some CPUs being idle, or not fully used) the cpugov can lower this value. Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
* lscpu: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: cleanup man pageKarel Zak2013-08-231-33/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: allow a more flexible swap discard policyRafael Aquini2013-08-232-28/+89
| | | | | | | | | | | | | | | | | | | | Introduce the necessary changes to swapon(8) allowing a sysadmin to leverage the new changes introduced to sys_swapon by "swap: discard while swapping only if SWAP_FLAG_DISCARD_PAGES", therefore allowing a more flexible set of choices when selection the discard policy for mounted swap areas. This patch introduces the following optional arguments to the already existent swapon(8) "--discard" option, in order to allow a discard type to be selected at swapon time: * once : only single-time area discards are issued. (swapon) * pages : discard freed pages before they are reused. If no policy is selected both discard types are enabled. (default) [kzak@redhat.com: - support <policy> argument for short -d option too, - add errx() on unsupported policy name] Signed-off-by: Rafael Aquini <aquini@redhat.com> Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use libmnt_table reference counterKarel Zak2013-08-215-12/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use libmnt_cache reference countingKarel Zak2013-08-215-8/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_is_empty(), improve table list usageKarel Zak2013-08-201-2/+4
| | | | | | | | Currently you have to use mnt_table_remove_fs() + mnt_free_fs() to destroy the list in the table. This is complicated in same situations. This patch allows to use mnt_free_fs() only. Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: use loop-control to explicitly ask for deviceKarel Zak2013-08-061-0/+2
| | | | | | | | | | | | | | | | Now we use LOOP_CTL_GET_FREE ioctl to ask for free device, for example losetup -f foo.img Unfortunately, losetup(8) allows to ask for specified device losetup /dev/loop100 foo.img and in this case we assume that the device already exists in the system. This is incorrect, we should be able to use loop-control LOOP_CTL_ADD ioctl to ask for the specified device. Signed-off-by: Karel Zak <kzak@redhat.com>
* blkdiscard: use fstat() rather than stat() [coverity scan]Karel Zak2013-08-061-6/+5Star
| | | | | | | | | | Calling function "open(char const *, int, ...)" that uses "path" after a check function. This can cause a time-of-check, time-of-use race condition. .. well, in blkdiscard context it's mostly cosmetic change. Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: fix loop device name usageKarel Zak2013-08-051-4/+9
| | | | | | | | The code is not paranoid enough, loopcxt_set_device() only set the device name to loopdev struct, but it does not check if the device really exists. Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: make -j <path> more robustKarel Zak2013-08-051-10/+28
| | | | | | | | It's usually unnecessary as we compare devno and ino, but let's use absolute paths for situations when it's necessary to compare paths as strings. Signed-off-by: Karel Zak <kzak@redhat.com>
* setarch: prefer preprocessor rather than autotools checkSami Kerola2013-08-011-11/+11
| | | | | | | It seems to be pointless to spend time in ./configure phase when preprocessor has to perform #ifndef check anyway. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lscpu: fix shadow declaration [smatch scan]Sami Kerola2013-08-011-4/+4
| | | | | | sys-utils/lscpu.c:572:22: warning: symbol 'fd' shadows an earlier one Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setsid: add an option to wait child return valueDaniel Kahn Gillmor2013-08-012-5/+27
| | | | | | | | | | | | This change proposed in util-linux maillist by Damien Wyart in behalf of Daniel Kahn Gillmor. Sami Kerola changed the patch to use option rather than makign the default behavior of the command to change. Reported-by: Damien Wyart <damien.wyart@gmail.com> Reference: http://markmail.org/message/2z6qh5auk7wjie3l Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495881 CC: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: don't use pager for --followKarel Zak2013-07-291-1/+2
| | | | | References: https://bugzilla.redhat.com/show_bug.cgi?id=984666 Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: set errno for misaligned offsetsKarel Zak2013-07-191-6/+14
| | | | | References: https://bugs.archlinux.org/task/36189 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: update xfs docsKarel Zak2013-07-161-171/+173
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove references to adjtimex from man pageKarel Zak2013-07-151-11/+1Star
| | | | | | The adjtimex is optional on many distros. Signed-off-by: Karel Zak <kzak@redhat.com>
* eject: assigned value is never read [clang-analyzer]Sami Kerola2013-07-091-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lscpu: fix memory leak [clang-analyzer]Sami Kerola2013-07-091-1/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: assigned values are never read [clang-analyzer]Sami Kerola2013-07-091-3/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: inform user --show-delta and iso8601 time format does not mixSami Kerola2013-07-091-0/+3
| | | | | References: http://marc.info/?l=util-linux-ng&m=137267606929951&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: fix wording and formatting of man page for dmesgBenno Schulenberg2013-07-091-45/+47
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* unshare: add --mount-proc for pid namespacesKarel Zak2013-07-092-8/+30
| | | | | | | | | | | | | | | Based on patch from Mike Frysinger <vapier@gentoo.org>. Mike Frysinger wrote: When it comes to pid namespaces, it's also useful for /proc to reflect the current namespace. Again, this is easy to pull off, but annoying to force everyone to do it themselves. So let's add a --mount-proc to do the magic for us. The downside is that this also implies creating a mount namespace as mounting the new pid namespace /proc over top the system one will quickly break all other processes on the system. Signed-off-by: Karel Zak <kzak@redhat.com> Acked-by: Mike Frysinger <vapier@gentoo.or>
* unshare: add --fork options for pid namespacesMike Frysinger2013-07-092-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ability of unshare to launch a new pid namespace is a bit limited. The first process in the namespace is expected to be the "init" for it. When it's not, you get bad behavior. For example, trying to launch a shell in a new pid namespace fails very quickly: $ sudo unshare -p dash # uname -r 3.8.3 # uname -m dash: 2: Cannot fork # ls -ld / dash: 3: Cannot fork # echo $$ 1324 For this to work smoothly, we need an init process to actively watch over things. But forcing people to re-use an existing init or write their own mini init is a bit overkill. So let's add a --fork option to unshare to do this common bit of book keeping. Now we can do: $ sudo unshare -p --fork dash # uname -r 3.8.3 # uname -m x86_64 # ls -ld / drwxr-xr-x 22 root root 4096 May 4 14:01 / # echo $$ 1 Thanks to Michael Kerrisk for his namespace articles on lwn.net [kzak@redhat.com: - fix "forkif logic, remove --mount-proc] Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: make time stamps to be printed consistentlySami Kerola2013-07-012-11/+23
| | | | | | | | | | | | | | | | | | | Earlier uptime determination, which was done with sysinfo(2), had one second resolution, which made time stamps to be rounded unstable way depending on when a dmesg command was executed. In practical terms; the command below was supposed not to differ but it did. $ diff -q <(dmesg --ctime) <(sleep 0.5 ; dmesg --ctime) [kzak@redhat.com: - add -lrt to Makemodule.am, - fallback to sysinfo() based boot time - use #ifdef] CC: Kay Sievers <kay@vrfy.org> References: https://lkml.org/lkml/2013/6/30/37 Buglink: https://github.com/karelzak/util-linux/issues/24 Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: define is_timefmt() macro only onceKarel Zak2013-07-011-5/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: fix --human color initializationKarel Zak2013-07-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: regroup time related options close to each otherSami Kerola2013-07-011-6/+6
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: add --time-format option and ISO-8601 format to manualSami Kerola2013-07-011-0/+22
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: add iso-8601 time formatSami Kerola2013-07-011-3/+26
| | | | | | | | | | | The ISO-8601 should be welcomed by anyone who tries to parse dmesg time stamp, and compare them across servers. Time format tries to imitate coreutils 'date --iso-8601=ns' output, but instead of having nanoseconds the dmesg is using microseconds. Reference: http://www.cs.tut.fi/~jkorpela/iso8601.html Addresses: http://xkcd.com/1179/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: add --time-format optionSami Kerola2013-07-011-0/+22
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: convert time format bitfield to enumSami Kerola2013-07-011-82/+77Star
| | | | | | Foremost this commit makes time printing formats explicit. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* renice: exit with non-zero value when arguments cause warningsSami Kerola2013-07-011-1/+3
| | | | | | | | This commit also fixes potential error counter wrap, which theoretically could make command to exit with a success when it internally failed just correct amount of times. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* eject: Check host_status and driver_status when using SG_IO.Karel Zak2013-06-181-3/+21
| | | | | | | | | | | | | | | | | Based on Suse patch, originally from Anna Bernathova <anicka@suse.cz>, May 2008 SG_IO completion status is weird but still well defined. You'll need to check both host_status, driver_status and status to determine that a command actually succeeded. -- Tejun Heo, May 2008 Note that we also need to check driver_status and sense_buffer to detect situation when there is no medium. It's valid request to call eject(8) for device with no medium. References: https://bugzilla.novell.com/show_bug.cgi?id=358033 Signed-off-by: Anna Bernathova <anicka@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: fix mistaken word and some grammar in man page of mountBenno Schulenberg2013-06-181-12/+11Star
| | | | | Reported-by: Krzysztof Żelechowski <giecrilj@stegny.2a.pl> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* nsenter: Allow selecting the uid and gid to be used in the entered usernsRichard Weinberger2013-06-182-2/+27
| | | | | | | | | | | | Using -S (--setuid) and -G (--setgid) one can select the uid/gid which will be used in the entered user namespace. [kzak@redhat.com: - use setuid/gid unconditionally (always), - update man page] Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: be robust for empty target/source stringsKarel Zak2013-06-171-1/+4
| | | | | | | | | | * lib/canonicalize.c: don't interpret empty strings as relative paths * libmount: more robust libmnt_table find function and debug messages References: https://bugzilla.novell.com/show_bug.cgi?id=825150 Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'master' of https://github.com/eric-s-raymond/util-linuxKarel Zak2013-06-132-3/+3
|\ | | | | | | | | | | | | | | | | | | * 'master' of https://github.com/eric-s-raymond/util-linux: Fix broken list syntax. Restore use of correct alternation syntax using { | }. Re-layout a FILES section in the traditional style. Remove another .ti for .RS/.RE, and remove a .TP that broke list parsing. Replace .IP o with .IP \(bu, using the [nt]roff bullet character. Replace .ti operations with equivalent .RS/.RE pairs.
| * Fix broken list syntax.Eric S. Raymond2013-06-101-1/+1
| | | | | | | | | | Bodiless .TP entries and unterminated .TP lists interfere with page parsing.
| * Restore use of correct alternation syntax using { | }.Eric S. Raymond2013-06-101-2/+2
| | | | | | | | | | This is required in order for ther synopsis to be translated into the corresponding XML markup.
* | eject: unlock door before issuing CDROMEJECT commandAaron Lu2013-06-131-0/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If user has inserted a disc into the drive, the drive will normally be locked. When using eject command to eject the drive, we need to unlock the door first, or the CDROMEJECT command will fail. Though the 2nd attmpt to eject the drive with eject_scsi will succeed, it actually does two things: first to unlock the door and then to eject the tray, both with the SG_IO ioctl. The problem is, Linux SCSI driver keeps track of if a device is in locked state or not, if we go with SG_IO to do the unlocking, the driver will not be aware of the unlocking and would think the drive is locked while actually it has already been unlocked by the first SG_IO command. Fix this by issuing a unlock door command before the CDROMEJECT command in cdrom_eject. Prior to this fix, the following output is expected when there is a disc inside: [aaron@aaronlu util-linux-2.22.2]$ eject -v /dev/sr0 eject: device name is `/dev/sr0' eject: /dev/sr0: mounted on /run/media/aaron/CD_ROM eject: /dev/sr0: is whole-disk device eject: /dev/sr0: is removable device eject: /run/media/aaron/CD_ROM: unmounting eject: /dev/sr0: trying to eject using CD-ROM eject command eject: CD-ROM eject command failed eject: /dev/sr0: trying to eject using SCSI commands eject: SCSI eject succeeded After this fix, the following output is expected: [aaron@aaronlu util-linux-2.22.2]$ ./eject -v /dev/sr0 lt-eject: device name is `/dev/sr0' lt-eject: /dev/sr0: mounted on /run/media/aaron/CD_ROM lt-eject: /dev/sr0: is whole-disk device lt-eject: /dev/sr0: is removable device lt-eject: /run/media/aaron/CD_ROM: unmounting lt-eject: /dev/sr0: trying to eject using CD-ROM eject command lt-eject: CD-ROM eject command succeeded And the SCSI device's locked state is correct now. Signed-off-by: Aaron Lu <aaron.lu@intel.com>
* textual: improve clarity of some error messagesBenno Schulenberg2013-06-071-3/+3
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>