pidref: add pidref_verify() helper

This new helper can be used after reading process info from procfs, to
verify that the data that was just read actually matches the pidfd, and
does not belong to some new process that just reused the numeric PID of
the process we originally pinned.
This commit is contained in:
Lennart Poettering
2023-09-28 23:22:58 +02:00
parent 9cb7e49f11
commit ec8dc83530
2 changed files with 22 additions and 0 deletions
+2
View File
@@ -51,6 +51,8 @@ int pidref_kill(PidRef *pidref, int sig);
int pidref_kill_and_sigcont(PidRef *pidref, int sig);
int pidref_sigqueue(PidRef *pidfref, int sig, int value);
int pidref_verify(PidRef *pidref);
#define TAKE_PIDREF(p) TAKE_GENERIC((p), PidRef, PIDREF_NULL)
extern const struct hash_ops pidref_hash_ops; /* Has destructor call for pidref_free(), i.e. expects heap allocated PidRef as keys */