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>
commit f0a0ce7 makes debug mode implicit for the --test option.
Using the previous command syntax of --test and --debug
together invokes the undocumented Level 2 debugging when
setting the RTC. This can cause many thousands of lines of
output like:
1510967983.499968 < 1510967983.500000 (-0.000032)
Fix: bump Level 2 debugging to Level 9, just before the
other undocumented Level 10. This makes it improbable for
the development debug levels to be accessed unintentionally.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
* Start the ISO format flags at bit 0 instead of bit 1.
* Remove unnecessary _8601 from ISO format flag names to
avoid line wrapping and to ease readability.
* ISO timestamps have date-time-timzone in common, so move
the TIMEZONE flag to bit 2 causing all timestamp masks
to have the first three bits set and the last four bits
as timestamp 'options'.
* Change the 'SPACE' flag to a 'T' flag, because it makes
the code and comments more concise.
* Add common ISO timestamp masks.
* Implement the ISO timestamp masks in all applicable code
using the strxxx_iso() functions.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
This new function returns the GMT offset relative to its
argument. It is used in this patch to fix two bugs:
1) On platforms that the tm struct excludes tm_gmtoff,
hwclock assumes a one hour DST offset. This can cause
an incorrect kernel timezone setting. For example:
Master branch tested with tm_gmtoff illustrates the correct offset:
$ TZ="Australia/Lord_Howe" hwclock --hctosys --test | grep settimeofday
Calling settimeofday(1507494204.192398, -660)
Master branch tested without tm_gmtoff has an incorrect offset:
$ TZ="Australia/Lord_Howe" hwclock --hctosys --test | grep settimeofday
Calling settimeofday(1507494249.193852, -690)
Patched tested without tm_gmtoff has the correct offset:
$ TZ="Australia/Lord_Howe" hwclock --hctosys --test | grep settimeofday
Calling settimeofday(1507494260.194208, -660)
2) ISO 8601 'extended' format requires all time elements
to use a colon (:).
Current invalid ISO 8601:
$ hwclock
2017-10-08 16:25:17.895462-0400
Patched:
$ hwclock
2017-10-08 16:25:34.141895-04:00
Also required by this change:
login-utils/last.c: increase ISO out_len and in_len by one to
accommodate the addition of the timezone colon.
Signed-off-by: J William Piggott <elseifthen@gmx.com>