summaryrefslogtreecommitdiffstats
path: root/sys-utils
Commit message (Collapse)AuthorAgeFilesLines
* ipcs: add --bytes size output optionSami Kerola2012-12-192-1/+9
| | | | | | | | This makes the command being a little closer standard compliant. See IEEE Std 1003.1 referral link below for more information. References: http://pubs.opengroup.org/onlinepubs/009696799/utilities/ipcs.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: add --human readable size conversion optionSami Kerola2012-12-194-34/+106
| | | | | | | | | Introduces new function ipc_print_size() which will call size_to_human_string(), and handles the occasional '([k]bytes)' printing if default size format is requested. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: assist debuggingSami Kerola2012-12-191-6/+9
| | | | | | | One will be able to see enum symbols when debugging, which is not the case when values are specified as define list. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: swapon.8 option name fixSami Kerola2012-12-191-1/+1
| | | | | | | The commit 7ae8b469adda598fda28e4ea647d47905b43e172 added option --bytes, not the initial proposal which was changed after maillist discussion. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: fix memmory leak [coverity scan]Karel Zak2012-12-121-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: don't care about xasprintf() return codeKarel Zak2012-12-121-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: don't care about xasprintf() return codeKarel Zak2012-12-121-8/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: don't care about xasprintf() return codeKarel Zak2012-12-121-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: sanitize paths from non-root usersKarel Zak2012-11-261-2/+30
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: sanitize paths from non-root usersKarel Zak2012-11-261-0/+35
| | | | | | | | | | | | | | | | | | | | | | $ mount /root/.ssh/../../dev/sda2 mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot this is too promiscuous. It seems better to ignore on command line specified paths which are not resolve-able for non-root users. Fixed version: $ mount /root/.ssh/../../dev/sda2 mount: /root/.ssh/../../dev/sda2: Permission denied $ mount /dev/sda2 mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot Note that this bug has no relation to mount(2) permissions evaluation in suid mode. The way how non-root user specifies paths on command line is completely irrelevant for comparison with fstab entries. Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: remove unnecessary variableKarel Zak2012-11-231-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: remove print_perms()Sami Kerola2012-11-231-26/+0Star
| | | | | | The function is no longer in use. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual message queue id printing to use /procSami Kerola2012-11-232-26/+32
| | | | | | | | [kzak@redhat.com: - fix msgctl() call, move q_qbytes to ipc_msg_get_info] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_msg(), and add ipc_msg_get_info()Sami Kerola2012-11-233-45/+178
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual semaphore id printing to use /procSami Kerola2012-11-233-36/+72
| | | | | | | | | And reindent the print_shm() function. [kzak@redhat.com: move semctl(GET*...) calls to ipcutils.c] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_sem(), and add ipc_sem_get_info()Sami Kerola2012-11-233-40/+164
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual shared memory id printing to use /procSami Kerola2012-11-231-21/+24
| | | | | | | And reindent the print_shm() function. Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: fix ipc_shm_get_info(), use callocKarel Zak2012-11-231-11/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_shm()Karel Zak2012-11-233-14/+34
| | | | | | | | - don't expect maxid as argument in ipc_shm_get_info() - if there is @id argument then use it everywhere in ipc_shm_get_info() - don't call shmctl() if not necessary in do_shm() Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: read shared memory values from /procSami Kerola2012-11-233-39/+205
| | | | | | | | [kzak@redhat.com: - move to ipcutils.{c,h}, - fix datatypes to be arch independent] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: determine ipc limits from /procSami Kerola2012-11-234-101/+216
| | | | | | | | | | | | Some of the limit values are not dynamic. Like in kernel these values are #defined. [kzak@redhat.com: - use better names for functions, - add ipcutils.{c,h} - read also shmmax from /proc] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/path: rename functions to be more explicitKarel Zak2012-11-232-28/+29
| | | | | | ... and to have names compatible with lib/sysfs.c Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: (recursive) add a cache to the tableDave Reisner2012-11-161-0/+2
| | | | | | | | | | | Without this table libmount will not resolve paths, meaning that umounting by relative path will fail. [kzak@redhat.com: - use mnt_context_get_cache() to make it sensitive to --no-canonicalize cmdline option] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: (recursive) don't call umount(2) for already unmounted targetsKarel Zak2012-11-151-7/+31
| | | | | | | | | In the umount --recursive we follow entries from mountinfo, but the entries maybe already obsolete. Especially if the hierarchy of the mountpoints contains shared subtrees and umount(2) for one entry may generate umount for some other entry too. Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: clean --recursiveKarel Zak2012-11-151-0/+17
| | | | | | | - mark some options combinations mutually exclusive - reset libmount context before next umount (this is important!) Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: allways return MOUNT_EX_*Karel Zak2012-11-131-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add -R, --recursive optionDave Reisner2012-11-132-4/+85
| | | | | | | | | | | This allows unmounting of an entire tree of filesystems, which might be of particular interest for a shutdown initramfs. [kzak@redhat.com: - always return MOUNT_EX_* codes - cosmetic changes on coding style] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: make read_topology() more robust to avoid SIGFPEKarel Zak2012-11-131-6/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: Fix issue found on CPU hot-removeToshi Kani2012-11-121-22/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | read_basicinfo() relies on sysfs cpu directories "/sys/devices/system/cpu/cpu%d" with assumption that cpu logical number %d is always sequentially assigned for all CPUs. However, this assumption is not correct with CPU hot-remove operation since it removes a target sysfs cpu directory after it is ejected. As a result, lscpu may not recognize all CPUs. The issue can be easily reproduced on KVM or VirtualBox, which supports CPU eject operation, as follows. 1) The system has 4 CPUs $ lscpu -a -e CPU NODE SOCKET CORE L1d:L1i:L2 ONLINE 0 0 0 0 0:0:0 yes 1 0 1 1 1:1:1 yes 2 0 2 2 2:2:2 yes 3 0 3 3 3:3:3 yes 2) Eject cpu2 # echo 1 > /sys/bus/acpi/devices/LNXCPU:02/eject 3) lscpu no longer recognizes cpu3 after cpu2 is ejected $ lscpu -a -e CPU NODE SOCKET CORE L1d:L1i:L2 ONLINE 0 0 0 0 0:0:0 yes 1 0 1 1 1:1:1 yes The following changes are made to address this issue. - Use maxcpus to allocate and parse bitmaps. - Set desc->ncpu from cpu/present, which includes both on-line and off-line CPUs. - Add is_cpu_present() to check if a CPU is present. Ejected CPUs are not present. [kzak@redhat.com: - read also /sys/devices/system/cpu/possible mask to determine maximal number of CPUs, - err() if possible mask is not found in /sys] Signed-off-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: allow to use -O without --listKarel Zak2012-11-121-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rename SIZE->SIZELIMITKarel Zak2012-11-121-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: mark old losetup output format as DEPRECATEDKarel Zak2012-11-121-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: add --list and --output optionOndrej Oprala2012-11-122-11/+261
| | | | | | | | | | | | | | | | The --list --all is the default output: # losetup NAME SIZE OFFSET AUTOCLEAR RO BACK-FILE /dev/loop0 0 0 0 0 /home/fs-images/swap.img /dev/loop1 0 100 0 0 /home/fs-images/disk.img [kzak@redhat.com: - default to --all if no device specified, - cleanup column names (add BACK- prefix) - add MAJ:MIN to of the loopdev device] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: supports paths canonicalization for alternative fstabsKarel Zak2012-10-241-0/+10
| | | | | | | | # mount --fstab /path/my.fstab has to support standard operations with paths. Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: fix compiler warning [-Wpointer-arith] and floating point exceptionKarel Zak2012-10-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: make readlink() usage more robustKarel Zak2012-10-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/c: move usleep() fallback to c.hKarel Zak2012-10-222-4/+1Star
| | | | | | To make it available everywhere in code. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount, eject: replace index() and rindex() with strrch() or strrchr()Sami Kerola2012-10-221-1/+1
| | | | | | | | | | Both index() and rindex() are legacy functions which may be withdrawn in a future. Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/rindex.html Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/loopdev: improve debug messagesKarel Zak2012-10-171-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: Add a --color option to colorize error and panic messagesOndrej Oprala2012-10-162-3/+40
| | | | | | | | [kzak@redhat.com: - update man page - colorize critical messages too] Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* mount: add long options for -L and -U to man pageBill Pemberton2012-10-161-2/+2
| | | | | | | The -L and -U flags both have long options too (--label and --uuid). The usage() function will show them but the man page didn't list them. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
* mount: add -c abbreviation for --no-canonicalize to man pageBill Pemberton2012-10-161-1/+1
| | | | | | | | The --no-canonicalize option can also be set using -c. The --help for mount shows this option but the man page did not. Add -c to the man page. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
* hwclock: add the --compare option to the man pageBill Pemberton2012-10-161-0/+5
| | | | | | | The compare option for hwclock was not listed in the man page. This adds a simple decription of it. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
* swapon: remove loop declaration [smatch scan]Sami Kerola2012-10-151-1/+2
| | | | | | | sys-utils/swapon.c:677:2: error: 'for' loop initial declarations are only allowed in C99 mode Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: clarify swapon.8 priority optionSami Kerola2012-10-151-2/+3
| | | | | | | Value -1 is valid argument for -p, even though it might not make much sense as the -1 is in use when priority is not specified at all. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: check numeric user inputsSami Kerola2012-10-151-1/+2
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: align blkdiscard.8 with how-to-man-page.txtSami Kerola2012-10-151-28/+34
| | | | | | | | * Add spaces after dots (English spacing). * Remove use of inline emphasis where possible. * Use mail and url macros. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fix bold style of man page referencesMike Frysinger2012-10-096-9/+10
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* mount: add verbose messagesKarel Zak2012-10-092-1/+47
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=864227 Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: fix in usage()Karel Zak2012-10-031-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>