Commit Graph

2471 Commits

Author SHA1 Message Date
Michael Kerrisk (man-pages) 5a82980632 docs: (man) remove double quotes (") in .SH lines
Using double quotes in .SH lines containing multiple words is unneeded,
and in any case is not consistently done in the util-linux manual pages,
where double quotes are used in only around half of the cases.
(This usage was long ago elminated in the man-pages project, with
no ill effects reported to date.)

Remove these quotes, so that .SH lines are more uniform, in preparation
for some (more easily) scripted doiscovery of consistency problems in
(and possibly global fixes to) the manual pages.

Other than stripping the double quotes, this patch makes no changes to
the content of the manual pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 12:15:34 +02:00
Yannick Le Pennec 5fdb086696 docs: Fix dead references to kernel documentation
Most date back to reorganisation of the Documentation/ tree in 2016,
new paths based on v5.7-rc5:

fdisk.8:   Documentation/{,admin-guide/}devices.txt
eject.c:   Documentation/{,userspace-api/}ioctl/cdrom.rst
mount.8:   Documentation/filesystems/adfs.{txt,rst}
rfkill.8:  Documentation/{rfkill.txt,driver-api/rfkill.rst}
tunelp.8:  Documentation/{parport.txt,admin-guide/parport.rst}
zramctl.8: Documentation/{blockdev/zram.txt,admin-guide/blockdev/zram.rst}

Signed-off-by: Yannick Le Pennec <yannick.lepennec@live.fr>
2020-05-18 10:35:31 +02:00
Michael Kerrisk ae4ab16031 ipcs.1: ipcs no longer needs read permission on IPC resources
With changes starting around util-linux commit 058e81540f
that switched from using IPC_STAT to parsing /proc/sysvipc/*,
ipcs now shows all IPC objects rather than just the objects for
which the user has read permission. Update the page to reflect this
fact, and also add a NOTES section describing the historical and
fallback behavior where /proc is not available.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-18 10:35:31 +02:00
Bjarni Ingi Gislason c5178f2796 docs: Some minor fixes in some manuals
Output is from: test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z

  [ "test-groff" is a developmental version of "groff" ]

Input file is ././misc-utils/kill.1

<./misc-utils/kill.1>:173 (macro BR): only 1 argument, but more are expected

Input file is ././misc-utils/lsblk.8

troff: backtrace: '/home/bg/git/groff/build/s-tmac/an-old.tmac':478: macro 'BR'
troff: backtrace: file '<./misc-utils/lsblk.8>':122
troff: <./misc-utils/lsblk.8>:122: warning: trailing space

Input file is ././sys-utils/mount.8

an-old.tmac: <./sys-utils/mount.8>:2427 (.RE): warning: extra .RE or .RS is missing before it; "an-RS-open" is 0.

Input file is ././sys-utils/unshare.1

<./sys-utils/unshare.1>:176 (macro BR): only 1 argument, but more are expected
<./sys-utils/unshare.1>:181 (macro BR): only 1 argument, but more are expected
<./sys-utils/unshare.1>:240 (macro BR): only 1 argument, but more are expected
<./sys-utils/unshare.1>:246 (macro BR): only 1 argument, but more are expected

Input file is ././term-utils/agetty.8

troff: backtrace: file '<./term-utils/agetty.8>':130
troff: <./term-utils/agetty.8>:130: warning: trailing space

Input file is ././text-utils/more.1

troff: backtrace: file '<./text-utils/more.1>':91
troff: <./text-utils/more.1>:91: warning: macro 'b' not defined

  The output from nroff and troff is unchanged, except for the word
"number" in text-utils/more.1, that was missing.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2020-05-18 10:35:25 +02:00
Johannes Thumshirn 7a2602f629 blkzone: deny destructive ioctls on busy blockdev
If a user submits a zone management ioctl from user-space, like a zone
reset and a file-system (like zonefs or f2fs) is mounted on the zoned
block device, the zone will get reset and the file-system's cached value
of the zone's write-pointer becomes invalid.

Subsequent writes to this zone from the file-system will result in
unaligned writes and the drive will error out.

Open the block device file in exclusive mode for submitting these ioctls.
If a file-system is mounted the kernel will return -EBUSY and we can't
continue issuing the ioctl.

[kzak@redhat.com: - remove unnecessary error message]

Reported-by: Coly Li <colyli@suse.de>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-15 14:53:11 +02:00
Karel Zak f52eed867a docs: add swap to 1st fstab field
Addresses: https://github.com/karelzak/util-linux/issues/1027
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-04 11:44:03 +02:00
michael-dev 0d5260b66c unshare: Fix PID and TIME namespace persistence
After unshare(...) is called, /proc/self/ns/pid does not change.
Instead, only /proc/self/ns/pid_for_children is affected. So bind-mounting
/proc/self/ns/pid results in the original namespace getting bind-mounted.

Fix this by instead bind-mounting ns/pid_for_children.

[kzak@redhat.com: - add ns/time_for_children
                  - remove C++ comments
                  - resolve commit conflicts]

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-30 10:59:38 +02:00
Luca BRUNO dac72b6e7e
fstrim: run service and timer only if /etc/fstab is present
The timer and service units run `fstrim --fstab`, which strictly
depends on `/etc/fstab` being present in the OS. This adds relevant
condition statements to the units, in order to skip them and avoid
runtime failures.

Ref: https://github.com/karelzak/util-linux/issues/673#issuecomment-409246816
Ref: https://github.com/coreos/bugs/issues/2591
Ref: https://github.com/coreos/fedora-coreos-tracker/issues/468

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
2020-04-27 10:08:53 +00:00
Stephen Kitt 32ff1494e3 docs: nsenter(1): fix further details in PID namespace section
The "Further details" sentence in the PID namespace section got merged
with the surrounding text; this patch moves it to the end, to match
the other namespace sections, and adds the missing clone(2) reference.

Fixes: 894efece9e ("Provide better cross references for namespace concepts")
Signed-off-by: Stephen Kitt <steve@sk2.org>
2020-04-27 11:32:05 +02:00
Karel Zak 7c16238c06 eject: fix compiler warning [-Wformat-overflow]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-22 10:32:49 +02:00
Rosen Penev ad52498014
[clang-tidy] fix misleading identation
Found with readability-misleading-indentation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-20 13:21:00 -07:00
Rosen Penev ed23cbce64
[clang-tidy] use ceil
Found with bugprone-incorrect-roundings

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-20 13:21:00 -07:00
Rosen Penev ad296391f9
[clang-tidy] fix wrong *cmp usage
Found with bugprone-suspicious-string-compare

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-20 13:21:00 -07:00
Rosen Penev 042f62dfc5
[clang-tidy] do not use else after return
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-20 13:20:59 -07:00
Rosen Penev bd89499e07
[clang-tidy] do not return in void functions
Found with readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-19 14:03:21 -07:00
Karel Zak 75c7684724 Merge branch 'map-user' of https://github.com/mat8913/util-linux
* 'map-user' of https://github.com/mat8913/util-linux:
  unshare: Support names for map-user/group options
  lib/pwdutils: add xgetgrnam
  unshare: allow custom uid/gid mappings in userns
2020-04-17 11:02:29 +02:00
Matthew Harm Bekkema 987550cbe8 unshare: Support names for map-user/group options
The --map-user and --map-group options can now be specified by either
uid/gid or user/group name.

Signed-off-by: Matthew Harm Bekkema <id@mbekkema.name>
2020-04-15 23:05:16 +10:00
Karel Zak a890611357 mount: support "-o move" on command line
Addresses: https://github.com/karelzak/util-linux/issues/997
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-15 13:39:48 +02:00
Lukas Czerner 7084db77e6 blkdiscard: (man) offset and length must be sector aligned
Update blkdiscard manual page. Length and offset values must be aligned
to the device sector size.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
2020-04-15 11:32:05 +02:00
Matthew Harm Bekkema 6e837b5a38 unshare: allow custom uid/gid mappings in userns
Two new options are added: `--map-user=<uid>` and `--map-group=<gid>`
for custom user and group mappings respectively. These are just
generalizations of the existing `--map-root-user` and
`--map-current-user` options.

As a side effect of this commit, specifying both `--map-root-user` and
`--map-current-user` no longer causes an error. Instead, the last
occurrence takes precedence.

Addresses: https://github.com/karelzak/util-linux/issues/885
Signed-off-by: Matthew Harm Bekkema <id@mbekkema.name>
2020-04-12 22:47:38 +10:00
Jann Horn d6cfb75428 docs: renice(1): Add chrt(1) to SEE ALSO
A user who wants to change the niceness of a process is likely to also be
interested in changing the scheduler class and/or RT priority.

Signed-off-by: Jann Horn <jannh@google.com>
2020-04-06 11:59:43 +02:00
Karel Zak 737b972fbc Merge branch '2020wk12' of https://github.com/kerolasa/util-linux
* '2020wk12' of https://github.com/kerolasa/util-linux:
  lslogins: use lastlog as wtmp fallback
  login: avoid lseek() with pread() and pwrite()
  libuuid: ensure variable is initialized [cppcheck]
  ctrlaltdel: display error message indicated by errno
2020-03-31 13:05:53 +02:00
Karel Zak 16debd23e8 Merge branch 'mips' of https://github.com/FlyGoat/util-linux
* 'mips' of https://github.com/FlyGoat/util-linux:
  lscpu: Adapt MIPS cpuinfo
2020-03-31 12:54:58 +02:00
Karel Zak ef89802e83 fstrim: rename --quite to --quite-unsupported
We use --verbose together with --quite in service files. It seems
confusing, let's make the option more descriptive.

Addresses: https://github.com/karelzak/util-linux/issues/1001
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-31 12:26:54 +02:00
Sami Kerola dcb87944c2
ctrlaltdel: display error message indicated by errno
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-03-29 20:19:11 +01:00
Jiaxun Yang 6cb8af7be2 lscpu: Adapt MIPS cpuinfo
MIPS have slightly different layout of cpuinfo.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
2020-03-28 12:19:42 +08:00
Damien Le Moal 46cf662532 blkzone: ioctl related code refactoring
[kzak@redhat.com: - generate patch from Damien's v3
                  - make commands[] initialization more robust]

Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-26 11:27:50 +01:00
Aravind Ramesh 0cecae9c03 blkzone: add open/close/finish commands
Introduce blkzone open, close and finish commands, issuing BLKOPENZONE,
BLKCLOSEZONE and BLKFINISHZONE ioctl commands to open, close or finish
a range of zones of a zoned block device.

Since these three commands are similar to the existing zone reset
command, the existing zone reset command implementation is changed into
the generic blkzone_action() internal handler function for processing
all zone actions.

The BLKOPENZONE, BLKCLOSEZONE and BLKFINISHZONE ioctl commands codes are
defined in linux/blkzoned.h starting with kernel version 5.5. To ensure
that the blkzone utility compiles even with older blkzoned.h kernel
header versions, these ioctl commands are internally defined if the
blkzoned.h header definition is not present. Execution of these commands
on kernels older than 5.5 will result in a -ENOTTY error (missing
ioctl).

Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Hans Holmberg <Hans.Holmberg@wdc.com>
Reviewed-by: Hans Holmberg <Hans.Holmberg@wdc.com>
2020-03-25 12:27:13 +01:00
Mark Barbone 9a7dc84118
Fix typo in the mount (8) man page 2020-03-19 18:13:46 -04:00
Karel Zak 8797cb31b9 Merge branch 'nsenter' of https://github.com/adrianreber/util-linux 2020-03-10 09:40:34 +01:00
Adrian Reber 7f1f0584c2
nsenter: add support for the time namespace
Just as with unshare and lsns this adds time namespace support to
nsenter.

In contrast to unshare nsenter does not have the options '--boottime'
and '--monotonic' as that offset can only be set as long as there have
no processes being started in the corresponding time namespace.

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-10 07:46:37 +01:00
Adrian Reber f218fd9784
unshare: use '-T' for time namespace instead of '-t'
While working on getting time namespace support into 'nsenter' it was
not possible to use '-t' to enter a time namespace as '-t' is the short
option for '--target'. Fortunately '-T' is still available in 'nsenter'
and 'unshare' and therefore let's change 'unshare' to use the same flag
for the time namespace as 'nsenter'.

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-09 13:26:28 +01:00
Karel Zak ef0341c9be Merge branch 'time-namespace' of https://github.com/adrianreber/util-linux
* 'time-namespace' of https://github.com/adrianreber/util-linux:
  unshare: support the time namespace
  unshare: fix help message indentation
2020-03-09 10:31:45 +01:00
Karel Zak d99d822d6e Merge branch 'lsns' of https://github.com/adrianreber/util-linux
* 'lsns' of https://github.com/adrianreber/util-linux:
  lsns: add time namespace support
2020-03-09 10:29:32 +01:00
Karel Zak a8fe698c45 Merge branch 'topic/irq' 2020-03-09 10:25:48 +01:00
Adrian Reber 96dc4f800d
lsns: add time namespace support
# ./lsns -t time
         NS TYPE  NPROCS   PID USER COMMAND
 4026531834 time     102     1 root /usr/lib/systemd/systemd --switched-root --system --deserialize 29
 4026532246 time       1 54797 root sleep 1000

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-09 10:19:50 +01:00
Adrian Reber be7df01a62
unshare: support the time namespace
This adds support to unshare for time namespaces. With the newly added
options '-t, --time' and '--monotonic' and '--boottime' it is now
possible to change CLOCK_MONOTONIC and CLOCK_BOOTTIME in a new time
namespace.

The time namespace has been merged in kernel version 5.6 and an easy way
to test it is using CLOCK_BOOTTIME and the uptime command:

 # uptime
 11:08:26 up 20:28,  1 user,  load average: 0.00, 0.00, 0.00
 # ./unshare --fork --time --boottime 100000000 uptime
 11:08:29 up 1158 days,  6:15,  1 user,  load average: 0.00, 0.00, 0.00

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-08 19:02:00 +01:00
Adrian Reber 6671501cfa
unshare: fix help message indentation
A few lines of the help message were unaligned in the output because of
mixes use of tabs and space. This removes all tabs and replaces them
with spaces.

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-08 19:02:00 +01:00
Sami Kerola fef6fa7d40
docs: fix spacing in irqtop and lsirq manual pages
And convert font changing macros to ones used in howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-03-07 06:38:57 +00:00
Sami Kerola 968a50b30e
lsirq: mark --json and --pairs options mutually exclusive
Before this change --pairs option would always win over --json.  That is
unnecessarily confusing, it is much better to disallow combination that does
not make sense.

Notice that the --noheadings in combination with --json or --pairs will not
cause any effect.  In strictest possible understanding --noheadings should
also be exclusive.  Looking from more relaxed point of view neither --json
nor --pairs has heading, so excluding is not necessary because --noheading
is happening already.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-03-07 06:38:57 +00:00
Karel Zak 5a20c0dec3 lsirq: add -P option
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 16:34:51 +01:00
Karel Zak dd52c4fa01 lsirq: add -n option
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 16:26:06 +01:00
Karel Zak a0f62b0b20 lsirq: add new command
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 16:21:10 +01:00
Karel Zak cb267d2a29 irqtop: cleanup man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 16:16:38 +01:00
Karel Zak 44e39c9940 irqtop: cleanup sort stuff
* user "cmp" in the function names (it does not sort)
* keep all in irq-common.c
* use column names on command line (e.g. --sort NAME)
* hardcode default to sort_result()

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 15:29:03 +01:00
Karel Zak e925cf378f irqtop: small cleanup in main() 2020-03-06 14:55:19 +01:00
Karel Zak 77f57b90f7 irqtop: cleanup struct irq_stat use
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 14:49:53 +01:00
Karel Zak 9c0740fc64 irqtop: move WINDOW back to control struct
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 14:21:46 +01:00
Karel Zak 02f2919e95 irqtop: minor cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 14:11:30 +01:00
Karel Zak 94e7e258a3 irqtop: move independent code to irq-common.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 14:04:33 +01:00