]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pidref: add trivial helper pidref_set_self() to set pidref to our handle to our own...
authorLennart Poettering <lennart@poettering.net>
Thu, 5 Oct 2023 07:47:42 +0000 (09:47 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 5 Oct 2023 15:08:35 +0000 (17:08 +0200)
src/basic/pidref.h

index 89f43157bac9ff786dc19e60e0fca892858254fb..b0427923e94b5a52c459a19205ebe33a55bfbf0d 100644 (file)
@@ -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);