Even when a mount namespace is created, previously host's sysfs is used,
especially with RootDirectory= or RootImage=, thus service processes can
still access the properties of the network interfaces in the main network
namespace through sysfs.
This makes, sysfs is remounted with the new network namespace tag, except
when PrivateMounts= is explicitly disabled. Hence, the properties of the
network interfaces in the main network namespace cannot be accessed by
service processes through sysfs.
Fixes#26422.
This is useful when creating a new network namespace. Unlike procfs,
we need to remount sysfs, otherwise properties of the network interfaces
in the main network namespace are still accessible through the old sysfs,
e.g. /sys/class/net/eth0. All sub-mounts previously mounted on the sysfs
are moved onto the new sysfs mount.
The function will be used in later commits.
If the boot ID cannot be obtained, let's first fallback to the machine
ID, and if still cannot, then let's use 0.
Otherwise, no timer event source cannot be triggered.
Fixes#26549.
We would print:
NEXT LEFT LAST PASSED UNIT >
Wed 2023-02-22 23:55:00 CET 20min left Wed 2023-02-22 23:25:00 CET 9min ago pmlogger_check.timer >
Wed 2023-02-22 23:55:10 CET 21min left Wed 2023-02-22 23:25:16 CET 8min ago pmlogger_farm_check.timer >
Wed 2023-02-22 23:58:00 CET 23min left Wed 2023-02-22 23:28:02 CET 6min ago pmie_check.timer >
Wed 2023-02-22 23:58:10 CET 24min left Wed 2023-02-22 23:28:11 CET 5min ago pmie_farm_check.timer >
Thu 2023-02-23 00:00:00 CET 25min left Wed 2023-02-22 00:00:10 CET 23h ago logrotate.timer >
Thu 2023-02-23 00:00:00 CET 25min left Wed 2023-02-22 00:00:10 CET 23h ago unbound-anchor.timer >
Thu 2023-02-23 00:08:00 CET 33min left Wed 2023-02-22 00:08:05 CET 23h ago pmie_daily.timer >
Thu 2023-02-23 00:10:00 CET 35min left Wed 2023-02-22 00:10:03 CET 23h ago pmlogger_daily.timer >
Thu 2023-02-23 00:14:14 CET 40min left Wed 2023-02-22 22:35:09 CET 58min ago dnf-makecache.timer >
Thu 2023-02-23 05:05:04 CET 5h 30min left Wed 2023-02-22 03:29:00 CET 20h ago plocate-updatedb.timer >
Thu 2023-02-23 11:34:34 CET 12h left Wed 2023-02-22 11:34:33 CET 11h ago systemd-tmpfiles-clean.timer >
Sun 2023-02-26 01:00:00 CET 3 days left Mon 2023-02-20 07:51:59 CET 2 days ago raid-check.timer >
Mon 2023-02-27 00:19:48 CET 4 days left Mon 2023-02-20 07:51:59 CET 2 days ago fstrim.timer >
Mon 2023-02-27 12:34:36 CET 4 days left Tue 2023-02-21 08:22:14 CET 1 day 15h ago archlinux-keyring-wkd-sync.time>
The "left" part uses precious screen estate and is pretty much implied
by the column name. Drop it.
This just adds the base functionality and some unit tests.
With TABLE_TIMESTAMP_RELATIVE we print "5s ago" and "5s left",
with the new TABLE_TIMESTAMP_LEFT, we print "5s ago" but "5s".
This is more useful for cases where we generally only want to
print timestamps in the future.
In older glibc (like 2.28 on CentOS Stream 8) there is no wrapper
for the gettid() syscall, so we need to provide our own.
../src/libsystemd/sd-journal/journal-send.c: In function ‘close_journal_fd’:
../src/libsystemd/sd-journal/journal-send.c:88:25: error: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Werror=implicit-function-declaration]
if (getpid() != gettid())
^~~~~~
getgid
../src/libsystemd/sd-journal/journal-send.c:88:25: warning: nested extern declaration of ‘gettid’ [-Wnested-externs]
cc1: some warnings being treated as errors
Follow-up to 50b35193ec.
Now that device path types are marked as packed we can safely cast and
access them. If we ever take the address of a member, we would get a
compiler warning.
In gnu-efi/EDK2 device paths are not marked as packed and instead the
Length field is split into 2 bytes. Accessing those requires these
helper macros as device paths may be unaligned.
Since our own efi headers define device path structs as packed, we can
access these directly, making code much more readable.
usec_t is also a uint64_t internally, hence this doesn't actually change
anything. However, on the conceptual level, sd-bus expects a uint64_t
hence give it one.
Timespans are probably best right-aligned, in particular if they
systematically end in either " ago" or " left" because they are used as
"relative timestamps".
Only service and scope units have RuntimeMaxUSec bus property.
To suppress the "Until:" field for other unit types, the entry must be
initialized with USEC_INFINITY.
Fixes#26473.