From: Lennart Poettering Date: Thu, 5 Oct 2023 07:47:42 +0000 (+0200) Subject: pidref: add trivial helper pidref_set_self() to set pidref to our handle to our own... X-Git-Tag: v255-rc1~321^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0ae589b3eff5e2c4e1ca9ec0ba781a1507434bf;p=thirdparty%2Fsystemd.git pidref: add trivial helper pidref_set_self() to set pidref to our handle to our own process --- diff --git a/src/basic/pidref.h b/src/basic/pidref.h index 89f43157bac..b0427923e94 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);