diff options
author | Luca Boccassi <bluca@debian.org> | 2023-01-16 23:46:01 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-01-18 10:58:46 +0100 |
commit | e0e7bc8223c3f28fcb48db9f0f003d9f03ca46d7 (patch) | |
tree | b4cd11a3508c2ec92080472aa7ca4391c8ff138a /test | |
parent | 9ca3bfb6c4d281bd047659b2891b5ac51c79ab34 (diff) | |
download | systemd-e0e7bc8223c3f28fcb48db9f0f003d9f03ca46d7.tar.gz |
core: add GetUnitByPIDFD method and use it in systemctl
A pid can be recycled, but a pidfd is pinned. Add a new method that is safer
as it takes a pidfd as input.
Return not only the D-Bus object path, but also the unit id and the last
recorded invocation id, as they are both useful (especially the id, as
converting from a path object to a unit id from a script requires another
round-trip via D-Bus).
Note that the manager still tracks processes by pid, so theorethically this
is not fully error-proof, but on the other hand the method response is
synchronous and the manager is single-threaded, so once a call is being
processed the unit database will not change anyway. Once the manager
switches to use pidfds everywhere, this can be further hardened.
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/testsuite-26.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/units/testsuite-26.sh b/test/units/testsuite-26.sh index 09470a6f06..ee84447d90 100755 --- a/test/units/testsuite-26.sh +++ b/test/units/testsuite-26.sh @@ -245,6 +245,7 @@ systemctl status "systemd-*.timer" systemctl status "systemd-journald*.socket" systemctl status "sys-devices-*-ttyS0.device" systemctl status -- -.mount +systemctl status 1 # --marked systemctl restart "$UNIT_NAME" |