Commit Graph

1671 Commits

Author SHA1 Message Date
Karel Zak 9a8fada18b setarch: let's keep analyzer happy [coverity scan] 2016-10-05 11:12:45 +02:00
Karel Zak a325f3c206 rtcwake: make sure buffer is zero terminated [coverity scan] 2016-10-05 11:11:45 +02:00
Karel Zak 3e11eaa831 lsns: fix mem leak [coverity scan] 2016-10-05 10:53:02 +02:00
Karel Zak 302419e8da findmnt: (verify) add docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-23 13:21:02 +02:00
Karel Zak c768892f4c findmnt: add --verify and --verbose
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-23 13:21:02 +02:00
Karel Zak 07332bfa1e swapon: fix discard option parsing
The current code does not work as expected if there is an option
behind the discard=<arg>, for example:

  swapon /dev/sdc -o discard=once,pri=10

ignores "once" the result is SWAP_FLAG_DISCARD; strace:

Old version:

  swapon("/dev/sdc", SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|10) = 0

Fixed version:

  swapon("/dev/sdc", SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|SWAP_FLAG_DISCARD_ONCE|10) = 0

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-21 15:08:50 +02:00
Karel Zak fa17791720 mount: add note about another flags for "remount,bind"
The man page is talking about read-only bind mounts (-o
remount,bind,ro), but this feature also works for another VFS flags
like nodev, suid, etc. For example:

 mount -o remount,bind,noatime /mountpoint

is a valid command.

Addresses: https://github.com/karelzak/util-linux/issues/342
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-08 11:57:34 +02:00
Karel Zak 2480b52743 mount: add note about paths verification to mount.8
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-31 09:48:43 +02:00
Karel Zak 29ad8689b8 umount: cleanup umount.8 about mtab
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-30 10:41:05 +02:00
Karel Zak d00eb87ba2 umount: fix obsolete info about loop= in umount.8
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1370959
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-30 10:25:44 +02:00
Karel Zak e215d467ca lib/pager: cleanup and extend API
* clean up function names

* add functions to temporary redirect to the pager and then restore
  original terminal output

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-26 12:07:25 +02:00
Karel Zak c424fd834b su, runuser, setpriv: create links between man pages
.. and add notes about differences between the utuils.

Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-18 11:12:44 +02:00
Karel Zak d8ba61fcb4 losetup: allow to use --nooverlap when device specified
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-17 13:52:22 +02:00
Stanislav Brabec f27d989c67 losetup: Prevent AUTOCLEAR detach race
Kernel needs some time to delete a device after losetup --detach. If
the losetup --find --nooverlay is called just after losetup --delete,
it can sometimes attempt to recycle the device that is just being
released.  To prevent this race, clear the AUTOCLEAR flag of the
device.

[kzak@redhat.com: - rebase to the new version of the code]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-17 12:58:12 +02:00
Karel Zak 9a94b634a3 losetup: add --nooverlap options
This patch introduces overlap detections and loop devices
re-use for losetup(8). We already support this feature for mount(8)
where it's enabled by default (because we mount filesystems and it's
always mistake to share the same filesystem between more loop
devices).

Stanislav has suggested to enable this feature also for losetup by
default. I'm not sure about it, IMHO it's better to keep losetup(8)
simple and stupid by default, and inform users about possible problems
and solutions in the man page.

The feature forces losetup to scan all loop devices always when new
one is requested. This maybe disadvantage (especially when we use
control-loop  to avoid /sys or /dev scans) on system with huge number
of loop devices.

Co-Author: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-17 12:28:33 +02:00
Michał Bartoszkiewicz 2b8889c44b lsns: support cgroup namespaces
Signed-off-by: Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
2016-08-16 13:36:12 +02:00
Karel Zak 64ffc95b0f Merge branch 'misc' of https://github.com/kerolasa/lelux-utiliteetit
* 'misc' of https://github.com/kerolasa/lelux-utiliteetit:
  pg: stop building the command by default
  kill: remove pid command-name to option alias
  misc: always check setenv(3) return value
2016-08-16 12:09:00 +02:00
Karel Zak 3082f8518f lsns: missing ns/<name> is not error
For example user namespace is optional it does not make sense to
ignore process completely if the ns/user file is missing.

Reported-by: Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-15 11:02:18 +02:00
Sami Kerola 984a60965a
misc: always check setenv(3) return value
At least glibc setenv(3) can fail when system runs out of memory.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-08-12 21:25:36 +01:00
Karel Zak c8bbdff083 Merge branch 'lo'
* lo:
  mount: small change to mount.8 loopdev section
  libmount: one iteration to detect overlap and reuse loopdev
  lib/loopdev: cleanup sizelimit check
  mount.8: Update loop device documentation
  tests: Add loop-overlay test
  libmout: Reuse loop device safely
  Implement loopcxt_check_conflict()
  Add sizelimit to internal API
  mount: Handle MNT_ERR_LOOPOVERLAP
  libmount: Introduce new error: MNT_ERR_LOOPOVERLAP
  libmount: Fix possible crash in mnt_context_setup_loopdev()
2016-08-04 11:57:49 +02:00
Karel Zak 03b4519b35 mount: small change to mount.8 loopdev section
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-04 11:56:50 +02:00
Heiko Carstens 2c497d3288 lscpu: print correct number of threads per core if possible
lscpu calculates the number of threads per core by dividing the number
of online cpus with the number of cores. This may or may not give the
correct number of threads per core depending on the number of online
CPUs (and which CPUs are online).

At least on s390 there is a new "max thread id" field within
/proc/cpuinfo present which reliably allows us to tell the number of
threads per core. Let's use this instead, like we already have also
special treatment to figure out the number core per socket etc. on
s390.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-08-03 13:35:05 +02:00
Heiko Carstens 6417dd7ffd lspcu: minor manpage improvement
Always use the word "can" instead of "may" to be consistent with the
descriptions of the other columns.

Also print "lspcu" always with bold characters like everywhere else in
the man page.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-08-03 13:35:05 +02:00
Heiko Carstens 0002704ebe lscpu: only try to read sysfs attributes of present CPUs
lscpu can skip all CPUs which are possible but not present. For
configurations where a lot of CPUs are possible but only few CPUs are
present this saves a lot of pointless glibc/system calls.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-08-03 13:35:05 +02:00
Heiko Carstens 0d2b5d2a72 lscpu: add --physical option
With the --physical option lscpu will use the IDs that are reported by
the kernel (e.g. core id for the CORE column) instead of calculating
them on it's own.

This has the advantage that it is possible to tell on which physical
hardware CPUs a Linux instance runs. The logical IDs that lscpu
generates on it own are based on comparing of CPU masks and may or may
not be identical with the physical IDs.

If the kernel was unable to retrieve an ID for a topology element then
the corresponding sysfs file will normally contain "-1". In the
extended and parsable output a dash "-" will be displayed for such
cases.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-08-03 13:35:05 +02:00
Stanislav Brabec 7aa390db98 mount.8: Update loop device documentation
New code checks both offset and sizelimit before re-using loop device.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2016-08-03 11:53:28 +02:00
Stanislav Brabec 74a4705a99 Add sizelimit to internal API
Fully safe checks of loop device need to check sizelimit. To prevent need of two
nearly equal functions, introduce sizelimit parameter to several internal
functions:
loopdev_is_used()
loopdev_find_by_backing_file()
loopcxt_is_used()
loopcxt_find_by_backing_file()

If sizelimit is zero, fall back to the old behavior (ignoring of sizelimit).

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2016-08-03 11:53:28 +02:00
Stanislav Brabec 41c9e5d366 mount: Handle MNT_ERR_LOOPOVERLAP
Use warnx(), as there is no strerror() text associated with it.

There is currently no easy way to report name and type of conflict.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2016-08-03 11:53:28 +02:00
Sami Kerola eb2306e675
misc: fix declarations shadowing variables in the global scope [oclint]
Fixes multiple occurences of 'optarg' overwrites.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-21 21:14:33 +01:00
Sami Kerola f6f1356f1c
dmesg: drop core at impossible case in read_buffer() [oclint]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-21 21:14:33 +01:00
Sami Kerola 7d55b2df2e
syspriv: flip inverted logic [oclint]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-21 21:14:33 +01:00
Sami Kerola 341154da28
switch_root: simplify code and reduce indentation [oclint]
The if statement in line 162 already ensures value of cfd to be 0 or
greater, so the later if is not needed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-21 21:14:33 +01:00
Sami Kerola 74ce680a3e
misc: simplify if clauses [oclint]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-21 21:14:33 +01:00
Allon Mureinik 6bc4cc18e6 blkdiscard: Improve man page
Improve the grammar and phrasing of the --verbose option and how it
interacts with the --step option.

Signed-off-by: Allon Mureinik <amureini@redhat.com>
2016-07-14 12:20:07 +02:00
Karel Zak 99ae5a4956 lsns: check for OOM
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-07-01 15:42:50 +02:00
Karel Zak 81a307bd4d lscpu: make lookup_cache() more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-24 11:07:00 +02:00
Heiko Carstens bfbe985eb4 lscpu: fix MMHZ column entry within man page
The indentation for the MMHZ column within the man page is wrong. Also
there doesn't exist any column with the name MMHZ. The correct names
would be MAXMHZ and MINMHZ.

Therefore rename MMHZ to MAXMHZ and add the missong MINMHZ entry.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-06-24 10:54:09 +02:00
Heiko Carstens 28b1658f8b lscpu: show additional caches (s390)
The Linux kernel exposes the cache topology via sysfs. However on
virtualized machines like s390 the cache topology contains only cpu
private caches.

For shared caches it is not known which cpus share them. The
hypervisor would have to update this information whenever a virtual
cpu would be scheduled on a different physical cpu and make the guest
aware of that change. Given that there is hardly any benefit, if it
all, this isn't done.

However it is still of interest to know about the non-private
caches. Therefore this information is available via /proc/cpuinfo at
least on s390.

This patch adds additional lines to the summary output for all shared
caches for which information can be found in /proc/cpuinfo, since we
know these aren't exposed via sysfs.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-06-24 10:54:09 +02:00
Heiko Carstens 0c28f0c815 lscpu: show machine type (s390)
Show also the machine type within the lscpu output. With the machine
type it is possible to identify the cpu generation and the supported
features.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-06-24 10:54:09 +02:00
Heiko Carstens 4632b28811 lscpu: show static and dynamic MHz (s390)
s390 machines provide static and dynamic cpu mhz information via
/proc/cpuinfo. The static cpu mhz is the normal cpu frequency a cpu is
supposed to run with.

The dynamic cpu mhz is the actual frequency a cpu is running
with. This is usually the same as the static cpu mhz. Note that this
values are different to the min/max mhz values available on other
architecutes. The min/max values are unknown.

This patch adds two new fields to the summary output which display
these two values.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-06-24 10:54:09 +02:00
Heiko Carstens 156740ca37 lscpu: fix typo in summary output
The new drawer support did have a type in the summary output:
it reported Drawers(s) instead of Drawer(s). Fix this.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-06-24 10:54:09 +02:00
Heiko Carstens b3adf6ef66 lscpu: add drawer support
The s390 architecture gained another cpu topology level called
"drawer" which is above the book level.

Add support for this to lscpu.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-06-24 10:52:32 +02:00
Sebastian Rasmussen 9e93004171 misc: Fix various typos
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.

Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
2016-05-31 23:40:21 +02:00
Sebastian Rasmussen d35df4db5b docs: Fix various typos
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
2016-05-31 23:40:21 +02:00
Karel Zak 54d172327b dmesg: fix indention
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-24 14:12:54 +02:00
Karel Zak bcf720693d lsipc: use strtime_short()
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-24 13:22:40 +02:00
Karel Zak bbdfcbe9f0 lsipc: use strtm_iso()
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-24 11:10:57 +02:00
Karel Zak 7c678f819b hwclock: use strtimeval_iso()
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-24 11:10:10 +02:00
Karel Zak 3c6e7c5414 dmesg: use strtimeval_iso()
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-24 11:09:41 +02:00
Mike Frysinger 5593132a90 man pages: fix spacing between man page name & section number
Most have standardized correctly, but fix a few latent ones.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-05-20 10:54:31 +02:00