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>
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>
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>
* 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>
* add -J to the man page
* add note about default output
* be compatible with another util-linux tools and use -J
Signed-off-by: Karel Zak <kzak@redhat.com>
* don't care about term size and attrs when runs only once
* explicitly define signals
* resize immediately after SIGWINCH (to keep it nice for users)
Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>
* 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>
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'.
Signed-off-by: Karel Zak <kzak@redhat.com>
The classic mount(8) behavior is to try read-only on write-protected devices
if the first mount syscall attempt ends with EACCES.
It seems we can implement this feature also for EBUSY if the same mount source
is already mounted with "ro" superblock option.
The typical use-case is iso image (always read-only) mounted on two places.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1809124
Signed-off-by: Karel Zak <kzak@redhat.com>
- 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>
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>
According to audit_log_user_message(3) result 1 is "success" and 0 is
"failed", we use standard EXIT_{SUCCESS,FAILURE} macros with reverse
status.
Addresses: https://github.com/karelzak/util-linux/issues/966
Signed-off-by: Karel Zak <kzak@redhat.com>