Commit Graph

15606 Commits

Author SHA1 Message Date
Seong-ho Cho a97c28c0a5 po: add ko.po (from translationproject.org) 2021-05-31 18:20:33 +02:00
Yuri Chornoivan ff58cee802 po: update uk.po (from translationproject.org) 2021-05-31 18:20:33 +02:00
Pedro Albuquerque 44f836d2dd po: update pt.po (from translationproject.org) 2021-05-31 18:20:33 +02:00
Jakub Bogusz 18d7d108c0 po: update pl.po (from translationproject.org) 2021-05-31 18:20:33 +02:00
Božidar Putanec e5f43da014 po: update hr.po (from translationproject.org) 2021-05-31 18:20:33 +02:00
Frédéric Marchal 435e838ac7 po: update fr.po (from translationproject.org) 2021-05-31 18:20:33 +02:00
Mario Blättermann 7e6634024e po: update de.po (from translationproject.org) 2021-05-31 18:20:33 +02:00
Petr Písař b952c8b30f po: update cs.po (from translationproject.org) 2021-05-31 18:20:33 +02:00
Karel Zak 95fbd2db43 libblkid: fix docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-31 18:16:57 +02:00
Karel Zak d58121a22a docs: update copyright years
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-31 18:12:07 +02:00
Karel Zak 1c0d193441 build-sys: remove with-cryptsetup from tools/config-gen.d/all.conf
Unfortunately libtools is not smart enough to link libblkid
dynamically if we link in-tree static libmount.a for libmount tests.
In this case libtools always uses also libblkid.a, but it's problem
for libcryptsetup which requires versioned symbols from libblkid.so

This is no problem for normal binaries, but for libmount tests only
(where we need static library to by-pass public library API).

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-31 17:44:10 +02:00
Ville Skyttä ecec8f1f90 lscpu: fix NVIDIA ARM hw implementer spelling case
Ref respective vendor sites.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-31 12:15:48 +02:00
Ville Skyttä d44a83c1f9 lscpu: recognize more ARM implementers
Add just the implementer string, no parts yet.

Refs https://developer.arm.com/documentation/ddi0595/2021-03/AArch64-Registers/MIDR-EL1--Main-ID-Register
Refs b90e90f40b/arch/arm64/include/asm/cputype.h (L54)

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2021-05-31 12:14:34 +02:00
Thomas Weißschuh 87579a96b2 lscpu: use optional json values
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2021-05-30 23:17:23 +02:00
Thomas Weißschuh f48554d48b libsmartcols: add support for optional boolean values
These default to `null` instead of `false`.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2021-05-30 23:17:23 +02:00
Thomas Weißschuh 17353ee0cd lscpu: use json types
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2021-05-30 23:17:17 +02:00
Karel Zak b97e2145fa po: add xgettext hint for non-c-format string
Reported-by: Petr Pisar <petr.pisar@atlas.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-27 10:39:58 +02:00
Karel Zak 684f921ec2 build-sys: add script to compare config.h from meson and autotools
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-26 13:20:21 +02:00
Karel Zak 647f80e491 meson: add missing header files check
Fixes: https://github.com/karelzak/util-linux/issues/1318
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-26 13:12:31 +02:00
Karel Zak 0a0af6161b lscpu: cleanup tab vs. space
Do not mix tab and space in structs initializations.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-26 11:54:47 +02:00
Bader Zaidan f2aadc1160 lscpu: Replace space with tabs
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-26 11:47:33 +02:00
Karel Zak 05cbd5aeed docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-25 13:45:24 +02:00
Karel Zak 96476550db tests: update lscpu outputs 2021-05-25 13:30:28 +02:00
Karel Zak f2d08d4ddc lscpu: read MHZ from /sys/.../cpufreq/scaling_cur_freq
This is more portable and provides more stable results than
/proc/cpuinfo.

Fixes: https://github.com/karelzak/util-linux/pull/1317
Co-Author: Thomas Weißschuh
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-25 13:30:13 +02:00
Karel Zak 0b538002da lscpu: use locale-independent strtod() when read from kernel
Reported-by: Thomas Weißschuh
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-25 11:32:51 +02:00
Karel Zak 670b10ae36 lib/c_strtod; add locale independent strtod()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-25 11:31:08 +02:00
Karel Zak afa7e09e4b tests: update lscpu output
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-24 13:43:02 +02:00
Karel Zak ff6513c74e lscpu: use MHZ as number to be locale sensitive
Fixes: https://github.com/karelzak/util-linux/issues/1316
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-24 13:39:53 +02:00
Karel Zak 9b9e4f5d06 lscpu: add SCALMHZ% and "CPU scaling MHz:"
$ lscpu
...
  Model name:           Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
    CPU family:         6
    Model:              60
    Thread(s) per core: 2
    Core(s) per socket: 4
    Socket(s):          1
    Stepping:           3
    CPU(s) scaling MHz: 61%
    CPU max MHz:        4400.0000
    CPU min MHz:        800.0000
...

$ lscpu -e=CPU,MAXMHZ,MINMHZ,MHZ,SCALMHZ%
CPU    MAXMHZ   MINMHZ      MHZ SCALMHZ%
  0 4400.0000 800.0000 2800.000      64%
  1 4400.0000 800.0000 4000.146      91%
  2 4400.0000 800.0000 2800.000      64%
  3 4400.0000 800.0000 2800.000      64%
  4 4400.0000 800.0000 2800.000      64%
  5 4400.0000 800.0000 4400.000     100%
  6 4400.0000 800.0000  800.000      18%
  7 4400.0000 800.0000 2800.000      64%

Addresses: https://github.com/karelzak/util-linux/issues/1314
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-24 13:39:53 +02:00
Karel Zak 419861d5bf sulogin: fix whitespace error
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-24 13:39:53 +02:00
Werner Fink 0d092db5c4 sulogin: ignore none-existing console devices
and also none-functional console devices. Redirect the error
messages to the appropiate console device.

Signed-off-by: Werner Fink <werner@suse.de>
2021-05-24 13:39:53 +02:00
Karel Zak 0f344e2432 lsns: fix old error message
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-24 13:39:53 +02:00
Karel Zak be1a10bb1f lsns: fix copy & past in man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-24 13:39:53 +02:00
Masatake YAMATO f91ffe44dd lsns: fill UID and USER columns for interpolated namespaces
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-05-24 13:39:53 +02:00
Masatake YAMATO 09710a2212 fixup! lsns: interpolate missing namespaces for converting forests to a tree 2021-05-24 13:39:53 +02:00
Masatake YAMATO de72df79d7 lsns: interpolate missing namespaces for converting forests to a tree
The tree of *parent* and *owner* could be forests because *lsns*
cannot track a namespace having no process.

This change tries interpolating the missing namespaces by calling
ioctl(NS_GET_PARENT) and ioctl(NS_GET_USERNS) recursively.

The original output for -Tparent:

    # ./lsns -Tparent
    NS             TYPE   NPROCS   PID USER   COMMAND
    4026531837     user      404     1 root   /usr/lib/systemd/sy
    ├─4026532508   user        1 29376 yamato /usr/lib64/firefox/
    ...
    └─4026533513   user        1 24245 yamato /usr/lib64/firefox/
    ...
    4026533733     user        1 30839 yamato /opt/google/chrome-
    4026533734     user       15 10076 yamato /opt/google/chrome-

user namespaces 4026533733 and 4026533734 are orphans.
lsns could not find their parents.

With this change:

    # ./lsns-with-changes -Tparent
    NS               TYPE   NPROCS   PID USER   COMMAND
    4026531837       user      404     1 root   /usr/lib/systemd/
    ├─4026532508     user        1 29376 yamato /usr/lib64/firefo
    ...
    ├─4026532639     user        0
    │ ├─4026532637   user        0
    │ │ └─4026533733 user        1 30839 yamato /opt/google/chrom
    │ └─4026533734   user       14 10076 yamato /opt/google/chrom

Now user namespaces 4026533733 and 4026533734 are integrated to the
tree. lsns interpolates the missing namespace 4026532639 and
4026532637 for the integration.

The original output for -Towner:

    # ./lsns -Towner
    NS             TYPE   NPROCS   PID USER   COMMAND
    4026531837     user      405     1 root   /usr/lib/systemd/s
    ├─4026531835   cgroup    431     1 root   /usr/lib/systemd/s
    ...
    4026532638     pid         1 30839 yamato /opt/google/chrome
    4026532640     pid         2 30837 yamato /opt/google/chrome
    ...

pid namespaces 4026532638 and 4026532640 are orphans.
lsns could not find their owners.

With this change:

    # ./lsns-with-changes -Towner
    NS               TYPE   NPROCS   PID USER   COMMAND
    4026531837       user      403     1 root   /usr/lib/systemd
    ├─4026531835     cgroup    429     1 root   /usr/lib/systemd
    ...
    ├─4026532639     user        0
    ...
    │ ├─4026532637   user        0
    │ │ ├─4026532638 pid         1 30839 yamato /opt/google/chro
    │ │ ├─4026533638 net         1 30839 yamato /opt/google/chro
    │ │ └─4026533733 user        1 30839 yamato /opt/google/chro
    │ ├─4026532640   pid         2 30837 yamato /opt/google/chro

Now pid namespaces 4026532638 and 4026532640 are integrated to the
tree. lsns interpolates the missing namespace 4026532639 and
4026532637 for the integration.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-05-24 13:39:53 +02:00
Masatake YAMATO c67b83c10d lsns: reorganize members specifying other namespaces in lsns_namespace
This is a preparation change for planed "tree interpolation" patch.

parentid, ownerid, parentns, and ownerns were members of
lsns_namespace struct. When interpolating missing namespaces
for building a unified name space tree, duplicated functions
are needed; one is for parentid and parentns members, and
another is for ownerid and ownerns members. To avoid the
duplication, this change unifies the members as following:

 parentid and ownerid => related_id [2]
 parentns and ownerns => related_ns [2]

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-05-24 13:39:53 +02:00
Masatake YAMATO e749d51a9c lsns: make namespace having no process printable
This is a preparation change for planed "tree interpolation" patch.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-05-24 13:39:53 +02:00
Naohiro Aota db22115875 libblkid: support zone reset for wipefs
We cannot overwrite superblock magic in a sequential required zone. So,
wipefs cannot work as it is. Instead, this commit implements the wiping by
zone resetting.

Zone resetting must be done only for a sequential write zone. This is
checked by is_conventional().

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
2021-05-24 13:39:53 +02:00
Naohiro Aota 6be38dccae libblkid: add magic and probing for zoned btrfs
This commit adds zone-aware magics and probing functions for zoned btrfs.

The superblock (and its copies) are the only data structure in btrfs with a
fixed location on a device. Since we cannot do overwrites in a sequential
write required zone, we cannot place the superblock in the zone.

Thus, zoned btrfs uses superblock log writing to update superblocks on
sequential write required zones. It uses two zones as a circular buffer to
write updated superblocks. Once the first zone is filled up, start writing
into the second buffer. When both zones are filled up, and before starting
to write to the first zone again, it reset the first zone.

We can determine the position of the latest superblock by reading the write
pointer information from a device. One corner case is when both zones are
full. For this situation, we read out the last superblock of each zone and
compare them to determine which zone is older.

The magics can detect a superblock magic ("_BHRfs_M") at the beginning of
zone #0 or zone #1 to see if it is zoned btrfs. When both zones are filled
up, zoned btrfs resets the first zone to write a new superblock. If btrfs
crashes at the moment, we do not see a superblock at zone #0. Thus, we need
to check not only zone #0 but also zone #1.

It also supports the temporary magic ("!BHRfS_M") in zone #0. Mkfs.btrfs
first writes the temporary superblock to the zone during the mkfs process.
It will survive there until the zones are filled up and reset. So, we also
need to detect this temporary magic.

Finally, this commit extends probe_btrfs() to load the latest superblock
determined by the write pointers.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
2021-05-24 13:39:53 +02:00
Naohiro Aota b250fbbf56 libblkid: implement zone-aware probing
This patch makes libblkid zone-aware. It can probe the magic located at
some offset from the beginning of some specific zone of a device.

This patch introduces some new fields to struct blkid_idmag. They indicate
the magic location is placed related to a zone and the offset in the zone.

Also, this commit introduces `zone_size` to struct blkid_struct_probe. It
stores the size of zones of a device.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
2021-05-24 13:39:53 +02:00
Karel Zak 3387ad72a6 lsns: make --tree default, update man-page
* make --tree=process default for 'lsns' and 'lsns <ns>'
* remove 'list' from struct lsns
* update man page

Addresses: https://github.com/karelzak/util-linux/pull/1281
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-24 13:39:53 +02:00
Masatake YAMATO 179dd17a6a lsns: fix passing wrong process lists when showing ownerns and parentns
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-05-24 13:39:53 +02:00
Masatake YAMATO 8d27b60530 lsns: unify the code and option for printing process based tree and namespace based trees
Suggested by Karel Zak.

`--tree` option is introduced as replacement for `--nstree`.
In addition to `parent` and `owner`, `--tree` take `process` as the
option argument.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-05-24 13:39:53 +02:00
Masatake YAMATO e8c56ae2d7 lsns: print namespace tree based on the relationship (parent/child or owner/owned)
Introduce new option -T[parent|owner]|--nstree[=parent|=owner].

With this change, lsns prints parent/child relationship tree if
"-T parent" is given and owner/owned relationship tree if "-T owner is given.

Passing only "-T" is same as passing "-Towner."

Example sessions:

    # ./lsns -Tparent -ons,type,pns| head -20
    NS             TYPE          PNS
    4026531837     user            0
    ├─4026532508   user   4026531837
    ├─4026532609   user   4026531837
    ├─4026532610   user   4026531837
    ├─4026532629   user   4026531837
    ├─4026532705   user   4026531837
    ├─4026532901   user   4026531837
    ├─4026533090   user   4026531837
    ├─4026533185   user   4026531837
    ├─4026533280   user   4026531837
    └─4026533468   user   4026531837
    4026531835     cgroup          0
    4026531836     pid             0
    └─4026533038   pid    4026531836
      ├─4026532934 pid    4026533038
      ├─4026533715 pid    4026533038
      ├─4026533716 pid    4026533038
      ...

    # ./lsns -Towner -ons,type,ons| head -20
    NS             TYPE          ONS
    4026531837     user            0
    ├─4026531835   cgroup 4026531837
    ├─4026531836   pid    4026531837
    ├─4026531838   uts    4026531837
    ├─4026531839   ipc    4026531837
    ├─4026531840   mnt    4026531837
    ├─4026531861   mnt    4026531837
    ├─4026532001   net    4026531837
    ├─4026532219   mnt    4026531837
    ├─4026532357   mnt    4026531837
    ├─4026532383   net    4026531837
    ├─4026532475   mnt    4026531837
    ├─4026532476   mnt    4026531837
    ├─4026532504   mnt    4026531837
    ├─4026532508   user   4026531837
    │ ├─4026532509 ipc    4026532508
    │ └─4026532511 net    4026532508
    ├─4026532573   mnt    4026531837
    ├─4026532574   mnt    4026531837

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2021-05-24 13:39:52 +02:00
Karel Zak aa049eabb3 lscpu: add MHZ to the -e output
Addresses: https://github.com/karelzak/util-linux/issues/1314
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-23 23:52:00 +02:00
Zbigniew Jędrzejewski-Szmek cacd3e7685 fstrim: do not start the timer in initrd
I'm working on building initramfs images directly from normal
packages, which means that the pristine system rpms should behave
correctly as much as possible also in the initrd. There usually isn't
enough time for the timer to actually fire, but starting it gives a
line on the console and generally looks confusing and sloppy. So let's
skip the timer if it ever ends up being enabled in the initrd.

Checking for /etc/initrd-release is the standard condition that
systemd's initrd units use.
2021-05-21 10:45:35 +02:00
Karel Zak 6dfa12395e Merge branch 'more-floating-point' of https://github.com/kerolasa/util-linux
* 'more-floating-point' of https://github.com/kerolasa/util-linux:
  more: fix floating point exception core dump
2021-05-20 09:32:53 +02:00
Karel Zak 3e8403522c fstrim: fix paths comparison
Fix: https://github.com/karelzak/util-linux/issues/1312
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-20 09:29:34 +02:00
Sami Kerola ec4153cc28
more: fix floating point exception core dump
Make the code avoid divided by zero.  This can happen when file has content
but is zero in size.  Such files can be found from procfs, possibly some
other pseudo-filesystems.  To reproduce the issue run the following.

    $ more /proc/crypto
    ...
    Floating point exception (core dumped)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2021-05-19 20:23:48 +01:00