* 'maybe-for-v2.32' of https://github.com/rudimeier/util-linux:
tests: use pgrep instead of ps --ppid ...
misc: fix typos using codespell
lsns: fix clang compiler warning
tests: add udevadm settle to sfdisk/resize
build-sys: disable bz2 tarball and fix some am warnings
../sys-utils/lsns.c:360:8: warning: comparison of integers of different signs: '__u32' (aka 'unsigned int') and 'int' [-Wsign-compare]
if (!(NLMSG_OK(nlh, reslen)
^~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/netlink.h:90:24: note: expanded from macro 'NLMSG_OK'
(nlh)->nlmsg_len <= (len))
~~~~~~~~~~~~~~~~ ^ ~~~
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Add a handful of more rare cores. Broadcom Brahma cores are
used in Access Points and Faraday was used on some Network
Storage Devices.
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Add a new section to the top of the filesystem-specific chapter to point
people generally to the filesystem-specific man pages. This way we can
delete all the redundant subsections that say the same thing.
These subsections are deleted because they offer no options. Which is
the same as all the filesystems the kernel supports but this man page
doesn't explicitly list (of which there are a few).
coherent minix ramfs romfs squashfs sysv xenix
These subsections are deleted because they simply point to the respective
<fs>(5) or mount.<fs>(8) page which we now document at the top. Some also
discuss the syscall ABI, but that doesn't seem appropriate for this page.
btrfs cifs ext2 ext3 ext4 nfs nfs4 proc smbfs tmpfs xfs
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
As discussed last year it's nice to be compatible to 2.6.32
https://www.spinics.net/lists/util-linux-ng/msg13963.html
BTW also re-define NUM_RFKILL_TYPES if needed, although we are
not really using it.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Undocumented at this time, because it is a skeleton
implementation. More debugging points are to be added after
refactoring is complete, or ad hoc in the mean time.
When fully implemented, enough time may have passed that the
deprecated --debug could be used to replace --ul-debug.
[kzak@redhat.com: - use __UL_INIT_DEBUG_FROM_STRING() to initialize the mask
- add hwclock_init_debug()]
Coauthored-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The closest I can get is with `mount`, so refer to that instead.
# mount none -t proc /proc
mount: /proc: none already mounted or mount point busy.
# umount /proc
umount: /proc: target is busy.
# (cd /root; umount proc)
umount: /proc: target is busy.
Signed-off-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
Since the kernel developers have refused to make /proc/cpuinfo user
understandable, implement mapping in userspace. lscpu is available for
most users via util-linux, so store the information here.
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
This page is out of date wrt proc mount options, so point it to the
proc(5) page which is kept up to date.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Let's make it possible to use debug.h without environment variables.
Suggested-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Warn on --debug; do not fallthrough because
the message is lost in the verbose output.
Coauthored-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
* introduce new flag __UL_DEBUG_FL_NOADDR to suppress pointer address printing
* use __UL_DEBUG_FL_NOADDR when SUID
* move ul_debugobj() to debugobj.h, and require UL_DEBUG_CURRENT_MASK
to provide access to the current mask from ul_debugobj(). It's better
than modify all ul_debugobj() calls and use the global mask as
argument.
* remove never used UL_DEBUG_DEFINE_FLAG
Reported-by: halfdog <me@halfdog.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lsns.c:683:2: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘ino_t’ [-Werror=format=]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This can delay entering to system sleep up to 0.28 seconds while discarding
input, when stdin is interactive device.
[kzak@redhat.com: - add note to the man page]
Reference: https://github.com/karelzak/util-linux/issues/527
See-also: a85c390134
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
The syscall swapon() with two arguments is supported since Linux 1.3.2
and it's really long time ago... Let's assume that all libc header files
have been already fixed.
Signed-off-by: Karel Zak <kzak@redhat.com>
Add more information when and why one might want to use various options.
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Print a message when the format_iso_time() buffer is exceeded, because
there is more than one type of failure that returns -1.
Also remove the corresponding message from hwclock.c.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Remove global variable, skip unnecessary comparison, and remove version
printing function when a simple printf() can do the job. In same go fix
compiler warning.
sys-utils/setarch.c:296:4: warning: null argument where non-null required
(argument 2) [-Wnonnull]
execl("/bin/bash", NULL);
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Based on patch from Vaclav Dolezal <vdolezal@redhat.com>, this
implementation is less invasive.
The patch adds a new while() for pread() call (so diff is mostly code
indention). The pread() is called for a real data only (addressed by
'off' and 'end') and we use SEEK_{DATA,HOLE} before the pread() to
skip already existing holes. The variables 'file_off' and 'file_end'
addresses area in the file as specified on fallocate command line.
Test:
$ truncate -s 10G testfile
$ dd if=/dev/zero of=testfile count=10 bs=1M conv=notrunc
old version:
$ time /usr/bin/fallocate --dig-holes --verbose testfile
testfile: 10 GiB (10737418240 bytes) converted to sparse holes.
real 0m3.013s
user 0m0.700s
sys 0m2.304s
new version:
$ time ./fallocate --dig-holes --verbose testfile
testfile: 10 MiB (10485760 bytes) converted to sparse holes.
real 0m0.026s
user 0m0.002s
sys 0m0.004s
The old version scans all file.
The change has minimal overhead for files without holes.
Addresses: https://github.com/karelzak/util-linux/issues/421
Co-Author: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The CDROM_SELECT_SPEED should be available practically everywhere. Where
the define is missing an error message about path /proc/sys/dev/cdrom/info
cannot be opened is better error than a warnx() about kernel support.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/nsenter.c: In function ‘is_same_namespace’:
sys-utils/nsenter.c:170:2: warning: ‘b_ino’ may be used uninitialized in this function [-Wuninitialized]
sys-utils/nsenter.c:170:2: warning: ‘a_ino’ may be used uninitialized in this function [-Wuninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/dmesg.c: In function ‘print_record.constprop.12’:
sys-utils/dmesg.c:1039:14: warning: ‘mesg_size’ may be used uninitialized in this function [-Wuninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
* don't use booleans
* use is_ prefix for boolean-like functions
* make nsfs_xasputs() more readable
* enable 'nowrap' together with 'raw' and don't test for "nowrap || raw"
* add missing 'W' to getopt_long()
Signed-off-by: Karel Zak <kzak@redhat.com>
This option forces lsns command not use
multi-line presentation when printing a cell.
Currently, it affects only NSFS column.
Implementing this option is suggested by Karl Zak.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
nsfs provides kernel level interface for assigning
logical name to a namespace. Following message is quoted
from git log of linux kernel:
commit 0226f4923f6c9b40cfa1c1c1b19a6ac6b3924ead
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Tue Dec 6 12:21:54 2011 -0500
vfs: take /proc/*/mounts and friends to fs/proc_namespace.c
rationale: that stuff is far tighter bound to fs/namespace.c than to
the guts of procfs proper.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
/proc/self/mountinfo lists the logical names for namespaces:
...
652 81 0:3 net:[4026532579] /tmp/XYZ rw shared:192 - nsfs nsfs rw,seclabel
...
In the lines /tmp/XYZ is a logical name for 4026532579 of net
namespace.
This patch adds nsfs column. It seems that the logical name is
used only in "ip netns" now. So the column is disabled by default.
Use '--type=net' or '-o NSFS' options to enable it.
This feature and the way to implementation using multi lines in a column
is Suggested by Karel Zak.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Linux network subsystem assigns an unique integer to a network
namespace.
term0# ip netns add UTIL-LINUX-LSNS-TEST-NS
term0# ip netns list
UTIL-LINUX-LSNS-TEST-NS
term0# ip link add name lsns-vetha type veth peer name lsns-vethb
term0 # ip link set lsns-vethb netns UTIL-LINUX-LSNS-TEST-NS
term0# ip netns list
UTIL-LINUX-LSNS-TEST-NS (id: 0)
term0# ip link show dev lsns-vetha
230: lsns-vetha@if229: <BROADCAST,MULTICAST> mtu 1500 qdisc noop ...
link/ether 3e:27:68:ba:b3:95 brd ff:ff:ff:ff:ff:ff link-netnsid 0
In this example 0 is assigned to UTIL-LINUX-LSNS-TEST-NS net namespace.
The name, UTIL-LINUX-LSNS-TEST-NS, and it semantics is given and defined
by iproute2 in userland; and nothing to do with util-linux.
However, the id, 0, is managed in linux kernel. If lsns can show
the ids, it helps users understand the state of network namespaces.
This commit adds NETNSID column to the output.
Here is an example of session:
term0# ip netns exec UTIL-LINUX-LSNS-TEST-NS cat
(Open another terminal)
term1# ./lsns --type net
NS TYPE NPROCS PID USER NETNSID COMMAND
4026531993 net 383 1 root unassigned /usr/lib/systemd/...
4026532433 net 1 1219 rtkit unassigned /usr/libexec/rtkit-daemon
4026532562 net 1 18201 root 0 cat
0 is shown as NETNSID for the cat process.
For the initial name space, "unassigned" is printed.
For the namespaces other type than net, "n/a" is printed.
If an error occurred during getting the id, "n/a" is printed.
Changes in V2:
* Remove wrongly used & operators.
* Make netnsid field empty if value for the column is not available.
Suggested by Karel Zak.
* Remove redundant condtion for checking the avaiablebility of netlink
socket. Suggested by Karel Zak.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
srett commented:
After some head scratching why relative wakeup using -s always works
while -t didn't seem to work at all I discovered that the adjustment
for time difference between sys and rtc is actually inverted when
writing the alarm (code for -m show reading is fine), so if the RTC
lags 10 minutes behind, the alarm will be shifted into the future by
10 minutes, resulting in a wakeup that is 20 minutes late.
Addresses: https://github.com/karelzak/util-linux/issues/544
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit reverts 1d5cffa16a.
(I did this revert manually as there was another changes in the code
and git-revert does not work in this case.)
Addresses: https://github.com/karelzak/util-linux/issues/543
Signed-off-by: Karel Zak <kzak@redhat.com>