наб
2f665f2437
networkctl: use uint64_t for link speed throughout
...
format-table used size_t/uint64_t interchangeably for TABLE_BPS,
and ethtool-util used SIZE_MAX to indicate SPEED_UNKNOWN,
which worked only on ABIs with 64-bit pointers.
For example, the tg3 driver returns SPEED_UNKNOWN with no link (cf.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/broadcom/tg3.c?id=3eb2efbea193789397c36f52b17d8692ac79bf68#n12190 )
which on x32 (and other 32-bit ABIs, presumably) caused
"networkctl status" to mark it with "Speed: 4Gbps":
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 32-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /libx32/ld-linux-x32.so.2,
BuildID[sha1]=36d684cb1fc8fb5060050d32b969e5aa172fa607, for GNU/Linux
3.4.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: 4Gbps
Whereas on 64-bit-pointer ABIs (here: amd64):
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=7a3e406e54968d7774ad467fc3f6a9d35ff7aea2, for GNU/Linux
3.2.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
With this patch, networkctl returns, for x32:
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2.1~networkctl-4g-v2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 32-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /libx32/ld-linux-x32.so.2,
BuildID[sha1]=36d684cb1fc8fb5060050d32b969e5aa172fa607, for GNU/Linux
3.4.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
And for amd64:
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=7a3e406e54968d7774ad467fc3f6a9d35ff7aea2, for GNU/Linux
3.2.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
2020-05-09 08:49:31 +02:00
Lennart Poettering
b0395c1176
format-table: support coloring the gap right of each cell individually
...
This is useful for underlining a whole row of cells: previously we
couldn't underline the gap. Now we can.
2020-05-06 15:40:15 +02:00
Lennart Poettering
557b0841b7
format-table: display an empty strv cell the same way as an empty cell
...
An empty list conceptually is very close to null, hence let's show it
the same way, i.e. using the defined "empty" string, and greyed out.
2020-05-06 15:40:15 +02:00
Lennart Poettering
e21b76cd68
format-table: generate better JSON field names
...
Let's try to mangle table contents a bit to make them more suitable as
JSON field names. Specifically when we see "foo bar" convert this to
"foo_bar" as field name, as variable/field names are generally assumed
to be without spaces.
2020-05-05 08:13:58 +02:00
Zbigniew Jędrzejewski-Szmek
162392b75a
tree-wide: spellcheck using codespell
...
Fixes #15436 .
2020-04-16 18:00:40 +02:00
Frantisek Sumsal
0080964cc8
format-table: allow hiding a specific column
...
without having to specify the whole display map
2020-03-11 14:43:52 +01:00
Lennart Poettering
137688dff4
format-table: add support for formatting uuids/id128 values
2020-01-20 17:42:03 +01:00
Yu Watanabe
4618660d10
format-table: introduce TABLE_STRV
2020-01-15 11:52:40 +09:00
Lennart Poettering
d91614e717
format-table: natively support multiline cells
...
This adds native support for multiline cells.
2020-01-13 16:38:28 +01:00
Lennart Poettering
bcf00b6c0a
format-table: allow forcing arbitrary width tables
...
Useful for implementing systemctl's --full.
See #14470
2020-01-10 11:53:28 +09:00
Yu Watanabe
f93d876c80
format-table: introduce TABLE_PATH
2020-01-09 20:16:03 +09:00
Zbigniew Jędrzejewski-Szmek
0db41a8f1f
shared/format-table: disable ellipsization when piped
...
Fixes #13461 .
Before:
$ systemd-inhibit --no-pager
WHO UID USER PID COMM WHAT WHY MODE
ModemManager 0 root 1093 ModemManager sleep ModemManage… delay
NetworkManager 0 root 1400 NetworkManager sleep NetworkMana… delay
UPower 0 root 5141 upowerd sleep Pause devic… delay
zbyszek 1000 zbyszek 10036 gsd-power handle-lid-switch External mo… block
zbyszek 1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:… GNOME handl… block
zbyszek 1000 zbyszek 10035 gsd-media-keys sleep GNOME handl… delay
zbyszek 1000 zbyszek 10036 gsd-power sleep GNOME needs… delay
7 inhibitors listed.
$ systemd-inhibit --no-pager|grep suspend
$ systemd-inhibit --no-pager|cat
WHO UID USER PID COMM WHAT WHY MODE
ModemManager 0 root 1093 ModemManager sleep Mode… delay
NetworkManager 0 root 1400 NetworkManager sleep Netw… delay
UPower 0 root 5141 upowerd sleep Paus… delay
zbyszek 1000 zbyszek 10036 gsd-power handle-lid-switch Exte… block
zbyszek 1000 zbyszek 10035 gsd-media-keys handle-power-key:h… GNOM… block
zbyszek 1000 zbyszek 10035 gsd-media-keys sleep GNOM… delay
zbyszek 1000 zbyszek 10036 gsd-power sleep GNOM… delay
After:
$ build/systemd-inhibit --no-pager
(same as above)
$ build/systemd-inhibit --no-pager|grep suspend
zbyszek 1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
$ build/systemd-inhibit --no-pager|cat
WHO UID USER PID COMM WHAT WHY MODE
ModemManager 0 root 1093 ModemManager sleep ModemManager needs to reset devices delay
NetworkManager 0 root 1400 NetworkManager sleep NetworkManager needs to turn off networks delay
UPower 0 root 5141 upowerd sleep Pause device polling delay
zbyszek 1000 zbyszek 10036 gsd-power handle-lid-switch External monitor attached or configuration changed recently block
zbyszek 1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
zbyszek 1000 zbyszek 10035 gsd-media-keys sleep GNOME handling keypresses delay
zbyszek 1000 zbyszek 10036 gsd-power sleep GNOME needs to lock the screen delay
7 inhibitors listed.
Note that this affect all tools that use format-table.c: machinectl, busctl,
loginctl, systemd-analyze, networkctl, portablectl.
2019-11-05 17:50:09 +01:00
Lennart Poettering
cd2d52d34f
Merge pull request #13216 from poettering/busctl-format-table
...
port "busctl list" to format-table.h
2019-07-29 20:44:54 +02:00
Lennart Poettering
2cb86a3e16
format-table: automatically show empty cells in grey
2019-07-29 18:48:38 +02:00
Lennart Poettering
728a22d3b1
format-table: add table_fill_empty() to fill in empty cells until the specified column is reached
2019-07-29 18:48:28 +02:00
Lennart Poettering
4ea710eaf4
format-table: if NULL is spcified as data, let's patch to an empty cell
...
This should make various calls easier that currently generate either an
empty cell or a regular cell depending on whether they have data to
show.
2019-07-29 18:48:25 +02:00
Lennart Poettering
7a9b4bb050
format-table: optionally show a specific string in empty cells
...
For some cases it might make sense to show "-" instead of just spaces
for empty cells.
2019-07-29 18:48:08 +02:00
Yu Watanabe
57894dc989
table: add missing NULL initialization
2019-07-29 23:30:32 +09:00
Yu Watanabe
e74294c30a
table: add TABLE_UINT8 or friends
2019-07-29 23:27:56 +09:00
Yu Watanabe
a7a257cdda
table: add TABLE_IN_ADDR and TABLE_IN6_ADDR
2019-07-29 23:22:14 +09:00
Lennart Poettering
c1b71f3a61
Merge pull request #13074 from poettering/format-tree-many
...
table_add_many() improvements
2019-07-16 16:03:54 +02:00
Lennart Poettering
6268974f88
format-table: add ability to set cell attributes within table_add_many()
...
table_add_many() is so much shorter and easier to read than
table_add_cell() with its accessors. Let's teach table_add_many() more
tricks, so that reverting to table_add_cell() is not needed that often
anymore.
2019-07-16 12:43:46 +02:00
Yu Watanabe
c5bbb2b5be
format-table: add TABLE_TIMESTAMP_UTC and _RELATIVE
2019-07-16 00:44:14 +09:00
Yu Watanabe
ba99f19c0d
format-table: add TABLE_TIMESPAN_MSEC
2019-07-16 00:09:39 +09:00
Yu Watanabe
9ff27e6413
table: introduce FORMAT_BPS type
2019-06-19 23:15:19 +09:00
Yu Watanabe
518a66ec08
tree-wide: replace if_indextoname() with format_ifname()
2019-05-29 14:21:19 +09:00
Yu Watanabe
8390d39165
table: add TABLE_IFINDEX type
2019-05-29 14:21:19 +09:00
Yu Watanabe
d553832698
table: add more basic types
2019-05-29 14:21:19 +09:00
Yu Watanabe
5896e03c6f
table: add teble_add_string_cell()
2019-05-29 14:21:19 +09:00
Ben Boeckel
5238e95759
codespell: fix spelling errors
2019-04-29 16:47:18 +02:00
Zbigniew Jędrzejewski-Szmek
2fe21124a6
Add open_memstream_unlocked() wrapper
2019-04-12 11:44:57 +02:00
Zbigniew Jędrzejewski-Szmek
ca78ad1de9
headers: remove unneeded includes from util.h
...
This means we need to include many more headers in various files that simply
included util.h before, but it seems cleaner to do it this way.
2019-03-27 11:53:12 +01:00
Lennart Poettering
760877e90c
util: split out sorting related calls to new sort-util.[ch]
2019-03-13 12:16:43 +01:00
Lennart Poettering
0a9707187b
util: split out memcmp()/memset() related calls into memory-util.[ch]
...
Just some source rearranging.
2019-03-13 12:16:43 +01:00
Lennart Poettering
94a80afed4
format-table: never try to reuse cells that have color/url/uppercase set
...
The table cell reusing code is supposed to be an internal memory
optimization, and not more. This means behaviour should be the same as
if we wouldn't reuse cells.
2018-12-03 22:42:38 +01:00
Lennart Poettering
359abf6dd0
format-table: add option to uppercase cells on display
...
This adds a per-cell option for uppercasing displayed strings.
Implicitly turn this on for the header row. The fact that we format the
table header in uppercase is a formatting thing after all, hence should
be applied by the formatter, i.e. the table display code.
Moreover, this provides us with the benefit that we can more nicely
reuse the specified table headers as JSON field names, like we already
do: json field names are usually not uppercase.
2018-12-03 22:42:38 +01:00
Lennart Poettering
31ac235771
format-table: optionally covert/output table to JSON
2018-12-03 22:42:38 +01:00
Lennart Poettering
c93d372d7c
format-table: use right field for display
...
Since .timespan and .timestamp are unionized on top of each other this
doesn't actually matter, but it is still more correct to address it
under it's correct name.
2018-12-03 22:42:38 +01:00
Lennart Poettering
88db94fa57
format-table: make sure we never call memcmp() with NULL parameters
2018-11-30 16:46:10 +01:00
Lennart Poettering
62d99b3970
format-table: add calls to query the data in a specific cell
2018-11-30 16:46:10 +01:00
Lennart Poettering
30d98de00c
format-table: always underline header line
2018-11-30 16:46:10 +01:00
Lennart Poettering
9314ead785
format-table: add an API for getting the cell at a specific row/column
2018-11-30 16:46:10 +01:00
Lennart Poettering
27e730e6d0
format-table: add table_update() to update existing entries
2018-11-30 16:46:10 +01:00
Lennart Poettering
a2c73e2d38
format-table: optionally allow reversing the sort order for a column
2018-11-30 16:46:10 +01:00
Lennart Poettering
a4661181fa
format-table: add option to store/format percent and uint64_t values in cells
2018-11-30 16:46:10 +01:00
Lennart Poettering
a22318e554
format-table: before outputting a color, check if colors are available
...
This is in many cases redundant, as a similar check is done by various
callers already, but in other cases (where we read the color from a
static table for example), it's nice to let the color check be done by
the table code itself, and since it doesn't hurt in the other cases just
do it again.
2018-11-30 16:46:10 +01:00
Lennart Poettering
165ca5663e
format-table: optionally make specific cells clickable links
2018-11-30 16:46:10 +01:00
Lennart Poettering
13b0d4d7bd
format-table: when duplicating a cell, also copy the color
2018-11-30 16:46:10 +01:00
Zbigniew Jędrzejewski-Szmek
d284b82b3e
Move various files that don't need to be in basic/ to shared/
...
This doesn't have much effect on the final build, because we link libbasic.a
into libsystemd-shared.so, so in the end, all the object built from basic/
end up in libsystemd-shared. And when the static library is linked into binaries,
any objects that are included in it but are not used are trimmed. Hence, the
size of output artifacts doesn't change:
$ du -sb /var/tmp/inst*
54181861 /var/tmp/inst1 (old)
54207441 /var/tmp/inst1s (old split-usr)
54182477 /var/tmp/inst2 (new)
54208041 /var/tmp/inst2s (new split-usr)
(The negligible change in size is because libsystemd-shared.so is bigger
by a few hundred bytes. I guess it's because symbols are named differently
or something like that.)
The effect is on the build process, in particular partial builds. This change
effectively moves the requirements on some build steps toward the leaves of the
dependency tree. Two effects:
- when building items that do not depend on libsystemd-shared, we
build less stuff for libbasic.a (which wouldn't be used anyway,
so it's a net win).
- when building items that do depend on libshared, we reduce libbasic.a as a
synchronization point, possibly allowing better parallelism.
Method:
1. copy list of .h files from src/basic/meson.build to /tmp/basic
2. $ for i in $(grep '.h$' /tmp/basic); do echo $i; git --no-pager grep "include \"$i\"" src/basic/ 'src/lib*' 'src/nss-*' 'src/journal/sd-journal.c' |grep -v "${i%.h}.c";echo ;done | less
2018-11-20 07:27:37 +01:00