Commit Graph

14090 Commits

Author SHA1 Message Date
Karel Zak ef0341c9be Merge branch 'time-namespace' of https://github.com/adrianreber/util-linux
* 'time-namespace' of https://github.com/adrianreber/util-linux:
  unshare: support the time namespace
  unshare: fix help message indentation
2020-03-09 10:31:45 +01:00
Karel Zak d99d822d6e Merge branch 'lsns' of https://github.com/adrianreber/util-linux
* 'lsns' of https://github.com/adrianreber/util-linux:
  lsns: add time namespace support
2020-03-09 10:29:32 +01:00
Karel Zak a8fe698c45 Merge branch 'topic/irq' 2020-03-09 10:25:48 +01:00
Adrian Reber 96dc4f800d
lsns: add time namespace support
# ./lsns -t time
         NS TYPE  NPROCS   PID USER COMMAND
 4026531834 time     102     1 root /usr/lib/systemd/systemd --switched-root --system --deserialize 29
 4026532246 time       1 54797 root sleep 1000

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-09 10:19:50 +01:00
Adrian Reber be7df01a62
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:

 # 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>
2020-03-08 19:02:00 +01:00
Adrian Reber 6671501cfa
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.

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-08 19:02:00 +01:00
Sami Kerola fef6fa7d40
docs: fix spacing in irqtop and lsirq manual pages
And convert font changing macros to ones used in howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-03-07 06:38:57 +00:00
Sami Kerola 968a50b30e
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.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-03-07 06:38:57 +00:00
Sami Kerola 723ec12457
bash-completion: update irqtop and lsirq completions
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-03-07 06:38:50 +00:00
Karel Zak 5a20c0dec3 lsirq: add -P option
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 16:34:51 +01:00
Karel Zak dd52c4fa01 lsirq: add -n option
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 16:26:06 +01:00
Karel Zak a0f62b0b20 lsirq: add new command
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 16:21:10 +01:00
Karel Zak cb267d2a29 irqtop: cleanup man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 16:16:38 +01:00
Karel Zak 44e39c9940 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()

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 15:29:03 +01:00
Karel Zak e925cf378f irqtop: small cleanup in main() 2020-03-06 14:55:19 +01:00
Karel Zak 77f57b90f7 irqtop: cleanup struct irq_stat use
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 14:49:53 +01:00
Karel Zak 9c0740fc64 irqtop: move WINDOW back to control struct
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 14:21:46 +01:00
Karel Zak 02f2919e95 irqtop: minor cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 14:11:30 +01:00
Karel Zak 94e7e258a3 irqtop: move independent code to irq-common.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 14:04:33 +01:00
Karel Zak c6ccf2ec96 irqtop: add struct irq_output
* add irq_output to keep top-like stufff independent on data
  management

* remove horrible "const"

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 13:38:02 +01:00
Karel Zak 212ca752c1 irqtop: keep table in functions only
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 12:56:56 +01:00
Karel Zak a6fa6aad4b irqtop: remove dead code
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 12:46:45 +01:00
Karel Zak ec95b4365f irqtop: separate normal and ncurses way
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 12:44:16 +01:00
Karel Zak d5280921be irqtop: remove unnecessary code
* remove unused code smp_num_cpus
* care about hostname and timer only real top-like output

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 12:36:41 +01:00
Karel Zak 60794bd2c6 irqtop: keep WINDOW pointer in functions only
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 12:32:39 +01:00
Karel Zak f675b00803 irqtop: separate screen and scols code
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 12:25:40 +01:00
Karel Zak bd83424b80 irqtop: reorder function
Move functions to make next changes more readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 12:12:12 +01:00
Karel Zak 487c746638 irqtop: cleanup command line options
* use -o for output columns (like we have in another tools)
* support -o +COLUMN

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-06 12:06:22 +01:00
Sami Kerola b5886f298e
irqtop: trim white spaces from end of name field
Excess white spaces were easiest to see in json output.

    $ irqtop --once --json
    {
       "interrupts": [
          {"irq":"LOC", "total":7425148, "name":"Local timer interrupts "},
          {"irq":"51", "total":1848384, "name":"IR-PCI-MSI 32768-edge i915 "},
          {"irq":"RES", "total":1176665, "name":"Rescheduling interrupts "},
          ...

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-03-04 21:40:24 +00:00
Karel Zak f5377ca454 irqtop: use -J for JSON
* 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>
2020-03-04 14:58:18 +01:00
Karel Zak 0d8ead9327 irqtop: don't print header for --once
We don't use any extra header for lsblk, lsmem, ... so don't make it
different.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-04 14:51:12 +01:00
Karel Zak 642f6cb0cb irqtop: simplify terminal resizing
* 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>
2020-03-04 14:47:20 +01:00
Karel Zak 6f99d9d613 iqrtop: cleanup header
* add '|' to make it more readable
* use time string without 'T'

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-04 14:17:27 +01:00
Karel Zak e0e2975998 rev: report line on error
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-04 13:20:56 +01:00
Karel Zak 8243036cae lscpu: use official name for HiSilicon tsv110
Addresses: https://github.com/karelzak/util-linux/issues/969
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-04 12:54:24 +01:00
Karel Zak e441601563 Merge branch 'topic/fdisk' 2020-03-03 16:22:10 +01:00
Karel Zak 006607abb5 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>
2020-03-03 16:20:05 +01:00
Karel Zak 5839a4ea03 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>
2020-03-03 16:15:39 +01:00
Karel Zak f94e753b35 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'.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-03 15:59:49 +01:00
Karel Zak 11b916cdab libmount: try read-only mount on write-protected superblock too
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>
2020-03-03 11:39:10 +01:00
Karel Zak acd229fc2a libmount: move "already mounted" code to separate function
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-03 10:55:28 +01:00
Karel Zak ac762ed71f 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>
2020-03-02 14:41:39 +01:00
Karel Zak fa3fface0f 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>
2020-03-02 12:27:36 +01:00
Karel Zak 940928c9f1 docs: add note about AsciiDocs
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-27 14:56:46 +01:00
Karel Zak 079dc9ddcd libuuid: add uuid_parse_range() to man page and symbol-table
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-27 14:52:06 +01:00
Karel Zak ef59d1908d Merge branch 'libuuid-range' of https://github.com/UQ-RCC/util-linux
* 'libuuid-range' of https://github.com/UQ-RCC/util-linux:
  libuuid: add uuid_parse_range()
2020-02-27 14:44:43 +01:00
Karel Zak 57b9d60cb5 su, runuser: (man) add more info about PATH and PAM
Addresses: https://github.com/karelzak/util-linux/issues/964
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-27 14:37:23 +01:00
Karel Zak 189edf1fe5 hwclock: fix audit exit status
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>
2020-02-27 14:04:55 +01:00
Karel Zak 1f47d4a2f0 chsh: (man) fix default behavior description
Addresses: https://github.com/karelzak/util-linux/issues/967
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-27 13:54:05 +01:00
Karel Zak c6d8486aad findmnt: make xalloc use mroe robust
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1807003
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-27 10:02:39 +01:00