Commit graph

220 commits

Author SHA1 Message Date
Thomas Weißschuh
e9ddea7912 lsclocks: new util to interact with system clocks
Usecases:
* Compare current monotonic time to timestamps reported by systemd
* Validate time namespace operations
* Inspect clock resolutions

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-30 14:12:48 +02:00
Karel Zak
fb062800be Merge branch 'nsenter-add-parent-ns-option' of https://github.com/igo95862/util-linux
* 'nsenter-add-parent-ns-option' of https://github.com/igo95862/util-linux:
  Add `--user-parent` option to nsenter
2023-06-26 14:04:52 +02:00
igo95862
01a6d803b5
Add --user-parent option to nsenter
When this option is used nsenter will fetch the parent user
namespace from any namespace file descriptors available.

It can be combined with existing `--user` option in which case
the parent user namespace will be fetched from the user namespace
and replace it.

The usecase of this option is when a user namespace that owns
the other type namespaces we want to switch to is not actually
bound to any process. Without using ioctl it is impossible to
acquire namespace file descriptor. For example, bubblewrap
`bwrap` command creates unbinded user namespace when `--dev`
option is used.
2023-06-23 00:26:13 +06:00
Rasmus Villemoes
ab7fe95ad7 hwclock: add --vl-read, --vl-clear documentation and bash-completion
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2023-06-22 10:27:36 +02:00
Karel Zak
96c8ff27a4 Merge branch 'next' 2023-05-29 14:56:52 +02:00
Karel Zak
cc665f33f4 Merge branch 'hexdump-one-byte-hex' of https://github.com/tpwo/util-linux
* 'hexdump-one-byte-hex' of https://github.com/tpwo/util-linux:
  hexdump: add new format-strings test case
  hexdump: add '--one-byte-hex' format option
2023-05-22 12:36:45 +02:00
Karel Zak
bd2ebbd4ea Merge branch 'enosys' of https://github.com/t-8ch/util-linux
* 'enosys' of https://github.com/t-8ch/util-linux:
  enosys: properly block execve syscall
  enosys: don't require end-of-options marker
  enosys: find syscalls at build time
  enosys: remove long jumps from BPF
  enosys: add --list
  enosys: validate syscall architecture
  enosys: add manpage
  enosys: add bash completion
  enosys: make messages useful for users
  enosys: translate messages
  enosys: add common arguments
  enosys: add test
  enosys: fix native arch for s390x
  enosys: syscall numbers are "long"
  enosys: mark variable static
  enosys: remove unneeded inline variable declaration
  enosys: improve checks for EXIT_NOTSUPP
  enosys: move from tests/helpers/test_enosys.c
  c.h: make err_nonsys available
2023-05-17 13:34:34 +02:00
Karel Zak
372e026e09 Merge branch 'mkswap/offset' of https://github.com/t-8ch/util-linux
* 'mkswap/offset' of https://github.com/t-8ch/util-linux:
  mkswap: implement --offset
  mkswap: (tests) don't overwrite logfiles
  mkswap: (tests) validate existence of truncate command
2023-05-17 13:27:55 +02:00
Thomas Weißschuh
7f104027e2 enosys: add --list 2023-05-16 22:44:50 +02:00
Thomas Weißschuh
ac5267423d enosys: add bash completion
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-05-16 22:44:50 +02:00
Tomasz Wojdat
bbf5bf8a88
hexdump: add '--one-byte-hex' format option
Signed-off-by: Tomasz Wojdat <tpwojdat@gmail.com>
2023-05-16 20:24:21 +02:00
Thomas Weißschuh
84ec6f99f7 mkswap: implement --offset
Addresses #2166

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-05-11 12:09:56 +02:00
Thomas Weißschuh
4832fd9f36 blockdev: add support for BLKGETZONESZ
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-05-05 10:57:52 +02:00
Thomas Weißschuh
eb8bf48d60 blockdev: add --getdiskseq to bash completion
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-04-26 09:09:09 +02:00
Christian Hesse
7c6e8709f8 add waitpid in bash-completion/Makemodule.am 2023-04-19 15:05:00 +02:00
Christian Hesse
526644982f add fadvise in bash-completion/Makemodule.am 2023-04-19 14:57:31 +02:00
Karel Zak
575d71fde1 nsenter: (man) add --keep-caps
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-04-13 12:29:55 +02:00
Thomas Weißschuh
97bb98effd nsenter: use explicit argument to follow target PID/GID
Making the argument to -S and -G optional in #2092 broke the cli
compatability.
So replace it with an explicit "follow" argument that provides the new
functionality with a compatible interface.

Fixes #2143
2023-04-03 18:44:15 +00:00
Karel Zak
7dcb35dd17 Merge branch 'waitpid/count' of https://github.com/t-8ch/util-linux
* 'waitpid/count' of https://github.com/t-8ch/util-linux:
  waitpid: allow to only wait for a specific number of process exits
2023-03-03 13:01:18 +01:00
Thomas Weißschuh
f0e793a3d9 waitpid: allow to only wait for a specific number of process exits
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-03-02 22:12:37 +00:00
u2386
4e9ec856a1 nsenter: add --env for allowing environment variables inheritance
This commit adds support for the -e or --env option in nsenter, allowing a new process to inherit the environment va

If the option is not given, the environment variables will stay the same as in the current namespace.

Example:
    Setup the namespace:
        $ docker run -d -e PROJECT='util linux' --rm alpine sleep 10000
        cb0b69aa7aec
        $ docker inspect --format '{{ .State.Pid }}' cb0b69aa7aec
        470012

    Enter the namespace:
        $ nsenter --all -t 470012 --env env
        PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        HOSTNAME=cb0b69aa7aec
        PROJECT=util linux
        HOME=/root

Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: u2386 <hugo.cavan2386@gmail.com>
2023-03-02 16:24:05 +00:00
Karel Zak
d9b022bd26 whereis: add glob(7) support (new option -g)
$ whereis -b -g 'find???'
find???: /usr/bin/findmnt /usr/bin/findscu

Fixes: https://github.com/util-linux/util-linux/issues/2021
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-01-25 14:30:36 +01:00
Karel Zak
b233ae61db fstrim: add --types to filter out by filesystem types
Fixes: https://github.com/util-linux/util-linux/issues/2040
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-01-24 19:03:15 +01:00
Karel Zak
a5a9b54429 swapon: add --fstab command line option
Let's add --fstab mount option for compatibility with mount(8).

Addresses: https://github.com/util-linux/util-linux/issues/2017
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-01-16 13:47:36 +01:00
Thomas Weißschuh
9d4028ff86 waitpid: adapt bash-completion for current functionality 2023-01-09 13:16:30 +00:00
Thomas Weißschuh
550d32c49e waitpid: add new command
This command implements waiting for the exit of multiple processes.
Especially it allows to wait for process that are not children of the
current process.

In contrast to wait(1P) it does not allow to retrieve the processes exit
codes.
2023-01-04 01:18:33 +00:00
Thomas Weißschuh
d883f868a8 umount: properly handle special characters in completion
Fixes #1834
2022-12-27 03:22:23 +00:00
Karel Zak
85a956a709 hardlink: cleanup options
* add missing stuff to bash-completion
* reorder --help output
* reorder man page

Signed-off-by: Karel Zak <kzak@redhat.com>
2022-12-08 11:12:47 +01:00
Karel Zak
21a73da6c6 bash-completion: add blkdiscard --quiet
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-12-07 11:13:48 +01:00
Karel Zak
1325de1756 rename: (bash-completion) fix typo
Fixes: https://github.com/util-linux/util-linux/issues/1928
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-11-28 09:47:18 +01:00
Karel Zak
1e6393de06 bash-completion: add --zero to rev module
Addresses: https://github.com/util-linux/util-linux/pull/1900
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-11-16 08:48:43 +01:00
Daniel Peukert
3383356263
rfkill: add toggle to bash completion
Signed-off-by: Daniel Peukert <daniel@peukert.cc>
2022-11-08 19:48:08 +01:00
Karel Zak
86938d0633 bash-completion: update lsns
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-11-08 10:11:57 +01:00
Masatake YAMATO
84b63b62f0 fadvise: add bash-completion script
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2022-10-06 03:05:07 +09:00
zhenwei pi
3b26273394 lsblk: introduce 'MQ' column
Typically a modern block device supports mutil queues feature, count
queues by walking '$sysfs/mq' directory. If no '$sysfs/mq' exists, it
is a legacy single queue.

~# lsblk --nvme -o NAME,TYPE,MODEL,TRAN,RQ-SIZE,MQ
NAME    TYPE MODEL                      TRAN   RQ-SIZE  MQ
nvme0n1 disk INTEL SSDPF2KX038TZ        nvme      1023 135
nvme3n1 disk INTEL SSDPE2KX020T8        nvme      1023 128
nvme1n1 disk SAMSUNG MZQL23T8HCLS-00A07 nvme      1023 129
nvme2n2 disk RP2A03T8RK004LX            nvme      1023  64
nvme2n3 disk RP2A03T8RK004LX            nvme      1023  64

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-06-06 12:31:56 +02:00
zhenwei pi
1b3e8f5d2c lsblk: add -v/--virtio
Add -v/--virtio to filter the virtio block devices.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-06-06 12:31:56 +02:00
zhenwei pi
97afabf71b lsblk: add -N/--nvme
Add -N/--nvme to filter NVMe device only, NVMe usually has a larger
I/O depth, also show COL_RQ_SIZE by default.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-06-06 12:31:56 +02:00
Karel Zak
6be39224f3 column: add --table-maxout
Add option to fill all available space.

Fizes: https://github.com/util-linux/util-linux/issues/1700
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-06-06 11:45:07 +02:00
Nathan Sharp
80af57ed9e pipesz: add bash-completion script
Signed-off-by: Nathan Sharp <nwsharp@live.com>
2022-05-18 10:35:34 +02:00
zhenwei pi
4b2fadb1bc irqtop: support -C/--cpu-list
Specify cpus list format to show by -C/--cpu-list parameters, for
example, on an AMD server with 192 CPUs, to show statistics on NUMA
node 1:
  ~# ./irqtop -d 1 -C 48-95,144-191

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-04-01 10:21:31 +02:00
Bastian Krause
b22b78b1be hwclock: add --param-set option
Implement the RTC_PARAM_SET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.

The new --param-set hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback and for values, hexadecimal (if prefixed with 0x) and decimal
values, as defined in [2], are accepted.

Example:

  $ hwclock --param-set bsm=0x0

[1] https://lore.kernel.org/all/20211018151933.76865-1-alexandre.belloni@bootlin.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/rtc.h

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2022-01-28 11:37:47 +01:00
Bastian Krause
6097b12df7 hwclock: add --param-get option
Implement the RTC_PARAM_GET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.

The new --param-get hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback, hexadecimal (if prefixed with 0x) and decimal values, as
defined in [2], are accepted.

Example:

  $ hwclock --param-get features

[1] https://lore.kernel.org/all/20211018151933.76865-1-alexandre.belloni@bootlin.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/rtc.h

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2022-01-28 11:37:47 +01:00
Karel Zak
c18ed0a6e6 build-sys: install lastb bash-completion
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-01-04 12:05:58 +01:00
Karel Zak
c4762c436b sfdisk add --backup-pt-sectors
The current option --backup is usable only when used with others sfdisk
commands. The new command --backup-pt-sectors create backup and exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-12-09 12:07:16 +01:00
Karel Zak
0cbb001a1e nsenter: add --wdns to change working directory
The current --wd=<dir> changes CWD to the path which is opened
*before* nsenter calls setns(). It may be useful if you want to use in
namespace something from your current namespace.  In this case, the
option --wd works like a "tunnel" between namespaces.

For some other use-cases, this is useless and you want to be sure that
CWD always points to the target namespace. For this purpose this patch
implements --wdns <dir>.

Example:

 Setup the namespaces:

  # unshare --mount
  # mount /dev/sdc /mnt/A
  # touch /mnt/A/fooooo
  # echo $$
  2425872

 Enter the namespace from another session:

  # nsenter --all --target 2425872 --wd=/mnt/A ls -a
  .  ..

  # nsenter --all --target 2425872 --wdns=/mnt/A ls -a
  .  ..  fooooo  lost+found

Fixes: https://github.com/util-linux/util-linux/issues/1500
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-11-22 13:18:54 +01:00
Karel Zak
d1732bba38 bash-completion: fix irqtop
Forgot update the option as introduced by commit
17f7caa451.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-11-10 10:56:02 +01:00
zhenwei pi
17f7caa451 irqtop: add -c/--cpu-stat option
Since a23aecc1bf("irqtop: add per-cpu stats"), irqtop always shows
per-cpu stats. Test on a modern AMD server with 2 socket(256 CPU),
irqtop shows messy output with too many columns.

In this patch, add -c/--cpu-stat option to enable/disable per-cpu stats.
And 'auto' option auto-detect window size, only show per-cpu stats
if the length of per-cpu stats is shorter than the width of window.

[kzak@redhat.com: - shorten the commit message
                  - rename --cpu to --cpu-stat
                  - use scols_table_enable_nowrap() rather than trim in irqtop.c
                  - reduce --help for the new option]

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-11-10 10:35:50 +01:00
Karel Zak
b1c137a948 bash-completion: add --json to dmesg
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-11-10 09:31:53 +01:00
Karel Zak
059811d096 su: (bash-completion) offer usernames rather than files
Fixes: https://github.com/karelzak/util-linux/issues/1424
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-31 12:51:40 +02:00
Naohiro Aota
ca5f4bd0d6 lsblk: add columns of zoned parameters
Several parameters for zoned devices are missing from lsblk's columns. This
commit introduces them as following.

 ZONE-SZ     zone size
 ZONE-WGRAN  zone write granularity
 ZONE-APP    zone append max bytes
 ZONE-NR     number of zones
 ZONE-OMAX   maximum number of open zones
 ZONE-AMAX   maximum number of active zones

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
2021-08-31 10:24:20 +02:00