summaryrefslogtreecommitdiffstats
path: root/sys-utils
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* dmesg: fix console-level off-by-oneBjørn Mork2012-10-021-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | commit f06ec64f dmesg; support level names (e.g. --console-level=alert) introduced an off-by-one error. The kernel will print messages with a *higher* level than the console-level. The bug made it impossible to set the level for debugging, like it is documented in e.g Documentation/networking/netconsole.txt : nemi:/tmp# dmesg -n 8 dmesg: unknown level '8' And attempting to set the "emerg" level would result in an invalid 0 value: nemi:/tmp# dmesg -n emerg dmesg: klogctl failed: Invalid argument Restoring the old behaviour for numeric levels, and mapping the level names so that "dmesg -n debug" behaves as expected: logging everything at level "debug" and higher. [kzak@redhat.com: - add comment to parse_level()] Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: fix a few typosMike Frysinger2012-10-021-12/+12
| | | | | | Nothing of note here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* ipcrm: avoid 'uninitialized' warningBernhard Voelker2012-10-021-1/+1
| | | | | | | | | | GCC 4.1.2 on SLES 10.4: sys-utils/ipcrm.c: In function ‘main’: sys-utils/ipcrm.c:297: warning: ‘what_all’ may be used uninitialized in this function * sys-utils/ipcrm.c: Initialize what_all to ALL. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* blkdiscard: add new commandLukas Czerner2012-09-283-0/+244
| | | | | | | | | | | | | blkdiscard is used to discard device sectors. This is useful for solid-state drivers (SSDs) and thinly-provisioned storage. Unlike fstrim this command is used directly on the block device. blkkdiscard uses BLKDISCARD ioctl or BLKSECDISCARD ioctl for the secure discard. All data in the discarded region on the device will be lost! Signed-off-by: Lukas Czerner <lczerner@redhat.com>
* Revert "blkdiscard: new command"Karel Zak2012-09-283-194/+36Star
| | | | | | | This was only attempt as alternative implementation, unfortunately pushed publicly... sorry. This reverts commit c84ed54cefdcaa07f3d1f40a65434c9d4277da08.
* blkdiscard: new commandKarel Zak2012-09-273-36/+194
| | | | | | | | | | | Add to fstrim(8) code to support new discard BLKDISCARD and BLKSECDISCARD ioctls for block devices. The new command is only symlink to fstrim(8) as the both utils share some code and the basic ideas. Based on patch from Lukas Czerner <lczerner@redhat.com>. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: don't warp the systemtime if the RTC is in UTCTom Gundersen2012-09-212-6/+22
| | | | | | | | | | | | | | | | | A sideeffect of 839be2ba6b44fa9dc927f081d547ebadec9de19c is that we now warp the systemtime according to the timezone, on the first call of --systz. This is not always the correct thing to do, and causes a regression for us in Arch Linux. The behavior is correct if the RTC, and hence the systemtime, is in localtime. However, if the systemtime is already in UTC we don't want to touch it when we set the kernel timezone (which we still need to do as some filesystems use this information). An almost identical issue was also fixed in systemd commit 72edcff5db936e54cfc322d9392ec46e2428fd9b. Signed-off-by: Tom Gundersen <teg@jklm.no>
* hwclock: wait time in hwclock is not long enough for some ARM devicesKarel Zak2012-09-211-2/+2
| | | | | | | | | | | | | On Sun, Sep 16, 2012 at 02:11:48PM +0800, Queen Adam wrote: > I'm using Archlinux ARM for my Melo A100 box. > The hwclock always timeout when using select() in rtc.c. > > After I change the timeout from 5 to 10, the problem is solved. > > In fact the timeout in my ARM box seems only to be a little larger > than 5s. Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: umount.8 syntax fix.Ville Skyttä2012-09-201-2/+2
| | | | Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
* rtcwake: doesn't reset wakealarmGiacomo2012-09-131-4/+19
| | | | | | | | Disable an alarm use the same logic used to enable it: first try RTC_WKALM_SET with the "enabled" flag set to false, if it fails fall back to RTC_AIE_OFF. Signed-off-by: Giacomo <giacomo.perale@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>