tree-wide: Use pidref_wait_for_terminate_and_check()

Let's use the pidref variants for waiting and
checking a process everywhere and get rid of the
non pidref variants.
This commit is contained in:
Daan De Meyer
2025-12-20 15:50:47 +01:00
parent e74b571004
commit fbd276cb86
56 changed files with 620 additions and 654 deletions
+4 -3
View File
@@ -8,6 +8,7 @@
#include "format-util.h"
#include "namespace-util.h"
#include "path-util.h"
#include "pidref.h"
#include "process-util.h"
#include "sort-util.h"
#include "stat-util.h"
@@ -286,7 +287,7 @@ int uid_range_load_userns(const char *path, UIDRangeUsernsMode mode, UIDRange **
}
int uid_range_load_userns_by_fd(int userns_fd, UIDRangeUsernsMode mode, UIDRange **ret) {
_cleanup_(sigkill_waitp) pid_t pid = 0;
_cleanup_(pidref_done_sigkill_wait) PidRef pidref = PIDREF_NULL;
int r;
assert(userns_fd >= 0);
@@ -294,12 +295,12 @@ int uid_range_load_userns_by_fd(int userns_fd, UIDRangeUsernsMode mode, UIDRange
assert(mode < _UID_RANGE_USERNS_MODE_MAX);
assert(ret);
r = userns_enter_and_pin(userns_fd, &pid);
r = userns_enter_and_pin(userns_fd, &pidref);
if (r < 0)
return r;
const char *p = procfs_file_alloca(
pid,
pidref.pid,
IN_SET(mode, UID_RANGE_USERNS_INSIDE, UID_RANGE_USERNS_OUTSIDE) ? "uid_map" : "gid_map");
return uid_range_load_userns(p, mode, ret);