diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-10-05 09:47:42 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-10-05 17:08:35 +0200 |
commit | b0ae589b3eff5e2c4e1ca9ec0ba781a1507434bf (patch) | |
tree | 859c39acf648f1c2d75f1d149b2608d5978af389 /src/basic/pidref.h | |
parent | pid1: allow creating scope units based in pidfds instead of plain pids (diff) | |
download | systemd-b0ae589b3eff5e2c4e1ca9ec0ba781a1507434bf.tar.xz systemd-b0ae589b3eff5e2c4e1ca9ec0ba781a1507434bf.zip |
pidref: add trivial helper pidref_set_self() to set pidref to our handle to our own process
Diffstat (limited to '')
-rw-r--r-- | src/basic/pidref.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/pidref.h b/src/basic/pidref.h index 89f43157ba..b0427923e9 100644 --- a/src/basic/pidref.h +++ b/src/basic/pidref.h @@ -39,6 +39,10 @@ int pidref_set_pidfd(PidRef *pidref, int fd); int pidref_set_pidfd_take(PidRef *pidref, int fd); /* takes ownership of the passed pidfd on success*/ int pidref_set_pidfd_consume(PidRef *pidref, int fd); /* takes ownership of the passed pidfd in both success and failure */ +static inline int pidref_set_self(PidRef *pidref) { + return pidref_set_pid(pidref, 0); +} + void pidref_done(PidRef *pidref); PidRef *pidref_free(PidRef *pidref); DEFINE_TRIVIAL_CLEANUP_FUNC(PidRef*, pidref_free); |