Adrian Reber [Mon, 9 Mar 2020 13:02:45 +0000 (13:02 +0000)]
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.
Adrian Reber [Mon, 9 Mar 2020 12:20:51 +0000 (12:20 +0000)]
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'.
Adrian Reber [Fri, 6 Mar 2020 11:05:00 +0000 (12:05 +0100)]
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:
Adrian Reber [Fri, 6 Mar 2020 11:03:50 +0000 (12:03 +0100)]
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.
Sami Kerola [Fri, 6 Mar 2020 20:14:06 +0000 (20:14 +0000)]
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.
Karel Zak [Fri, 6 Mar 2020 14:28:57 +0000 (15:28 +0100)]
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()
Karel Zak [Tue, 3 Mar 2020 15:10:02 +0000 (16:10 +0100)]
fdisk: add support for parttype aliases
* add list of supported aliases to 'l' and 'L' output
* support aliases in 't' dialog
For example (use 'swap' to set 0x82 partition type):
Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): swap
Changed type of partition 'Linux' to 'Linux swap / Solaris'.
Note that the aliases are evaluated as the last possibility if user's
input dues not match up with any partition type. This is necessary for
backward compatibility.
This patch does NOT introduce shortcuts (.e.g. 'S' for swap) to
fdisk(8) due to collisions with already used dialog keys.
Addresses: https://github.com/karelzak/util-linux/issues/958 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 3 Mar 2020 15:07:00 +0000 (16:07 +0100)]
sfdisk: extend --part-type, support aliases
* add support for aliases to sfdisk scripts
* add shortcuts and aliases to --part-type command
Note that --part-type evaluates shortcuts and aliases as the last
possibility (so after regular type string). This is necessary for
backward compatibility.
Example ('raid' type alias):
# sfdisk --part-type /dev/sdc 1 raid
# fdisk -l /dev/sdc
...
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 204799 202752 99M fd Linux raid autodetect
Example ('L' type shortcut):
# sfdisk --part-type /dev/sdc 1 L
# fdisk -l /dev/sdc
...
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 204799 202752 99M 83 Linux
Addresses: https://github.com/karelzak/util-linux/issues/958 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 3 Mar 2020 14:59:49 +0000 (15:59 +0100)]
libfdisk: add partition type aliases and shortcuts
Now, the type shortcuts are supported for sfdisk scripts only.
Unfortunately, the current implementation is not generic enough
and it's also fragile as 'E' shortcut is in collision with 0x0E
type for MBR. The another issue is 'L' which makes shortcuts useless
for fdisk where 'L' is used for another purpose in dialogs.
This patch introduces partition type aliases as extension to
shortcuts. The definition of the shortcut is part of the label
definition and it's not more hardcoded in sfdisk script code.
This patch also introduces 'Ex' shortcut as replacement for (now
deprecated) 'E'.
Karel Zak [Mon, 2 Mar 2020 13:41:39 +0000 (14:41 +0100)]
sfdisk: fix previous --append patch, improve man page
- fix stupid typo (!has_container_or_unused(sf))
- use fdisk_is_partition_used() as fdisk_get_partition() returns
nothing for unused partition
- update tests
- add more hints to the man page
Addresses: https://github.com/calamares/calamares/issues/1332 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 2 Mar 2020 11:27:36 +0000 (12:27 +0100)]
sfdisk: fix --append to PT with gaps
sfdisk trying to be more smart than libfdisk when analyze if we can
append to the current PT. libfdisk is able to use unused partition
to create a new one (if partno not strictly specified), but sfdisk
assumes that we can add partition to extended partition only.
Addresses: https://github.com/calamares/calamares/issues/1332 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 25 Feb 2020 14:31:23 +0000 (15:31 +0100)]
lsblk: fix -P regression from v2.34
Since v2.34 --list prints devices only once to make the output
user-readable. Unfortunately, it's regression for scripts/applications
where we need to parse lsblk output. So, let's make --pairs and --raw
backwardly compatible with versions before 2.34 and print all hierarchy.
Addresses: https://github.com/ibm-s390-tools/s390-tools/issues/80 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 25 Feb 2020 11:06:06 +0000 (12:06 +0100)]
libblkid: fix compiler warning [-Wsign-compare]
libblkid/src/superblocks/exfat.c: In function ‘probe_exfat’:
./include/c.h:133:17: warning: comparison of distinct pointer types lacks a cast
libblkid/src/superblocks/exfat.c:129:5: note: in expansion of macro ‘min’
./include/c.h:134:8: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
______________________________________________________
GNU C Library NEWS -- history of user-visible changes.
Version 2.31
Deprecated and removed features, and other changes affecting compatibility:
* The settimeofday function can still be used to set a system-wide time
zone when the operating system supports it. This is because the Linux
kernel reused the API, on some architectures, to describe a system-wide
time-zone-like offset between the software clock maintained by the kernel,
and the "RTC" clock that keeps time when the system is shut down.
However, to reduce the odds of this offset being set by accident,
settimeofday can no longer be used to set the time and the offset
simultaneously. If both of its two arguments are non-null, the call
will fail (setting errno to EINVAL).
Callers attempting to set this offset should also be prepared for the call
to fail and set errno to ENOSYS; this already happens on the Hurd and on
some Linux architectures. The Linux kernel maintainers are discussing a
more principled replacement for the reused API. After a replacement
becomes available, we will change settimeofday to fail with ENOSYS on all
platforms when its 'tzp' argument is not a null pointer.
settimeofday itself is obsolescent according to POSIX. Programs that set
the system time should use clock_settime and/or the adjtime family of
functions instead. We may cease to make settimeofday available to newly
linked binaries after there is a replacement for Linux's time-zone-like
offset API.
______________________________________________________
hwclock(8) had one settimeofday(2) call where both args were set for
--hctosys when the RTC was ticking UTC. This allowed setting the system
time, timezone, and locking the warp_clock function with a single call.
That operation now takes 3 calls of settimeofday(2).
Although this common operation now takes three calls, the overall logic
for the set_system_clock() function was simplified.
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: J William Piggott <elseifthen@gmx.com>
Sami Kerola [Sat, 22 Feb 2020 16:42:56 +0000 (16:42 +0000)]
irqtop: add total and delta as own columns
This commit add total and delta as separate columns rather than a toggle,
making output generally more informative. When using command I found that
sort order key bindings should match with first letter of column headers so
that they are as easy as possible to remember, and therefore enhancing user
experience.
Requested-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Fri, 21 Feb 2020 22:28:43 +0000 (22:28 +0000)]
irqtop: display number of new interupts in-between updates
The rirst output is total count followed by number of interupts since
previous screen update. This is how the irqtop worked before libsmartcols
was added to the command.
Sami Kerola [Sun, 5 Jan 2020 10:40:12 +0000 (10:40 +0000)]
irqtop: include hostname and timestamp to output header
Having a when and from where information is useful in situations when output
is examined later and possibly elsewhere. Typical example would be a
screenshot or output copy-paste of a terminal to a ticketing system.
Sami Kerola [Sun, 5 Jan 2020 09:27:19 +0000 (09:27 +0000)]
irqtop: use epoll event loop
The event loop takes care of the standard screen updates, signals, and user
inputs. Two nice things using even loop like this are; 1) no need for any
global variables and 2) effect of user commands is immediate.
Sami Kerola [Sat, 4 Jan 2020 09:35:19 +0000 (09:35 +0000)]
irqtop: fix open file descriptor leak
With very short delay one can see irqfile file descriptors pile up rather
quickly causing program to stop with too many open files error. This commit
fixes that, and removes couple other memory leaks. With these the command
should hopefully run fine for days if not even months.