From 0fc53d6e8f168fb120f4f9247fd1d502086ba490 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 29 Dec 2017 16:45:04 +0100 Subject: [PATCH] raw-clone: beef up raw_clone() wrapper a bit First of all, let's return pid_t, which appears to be the correct type given that we return PIDs, and it#s what fork() uses too. Most importantly though, flush out our PID cache, so that the call becomes compatible with our getpid_cached() logic. --- src/basic/process-util.c | 2 +- src/basic/process-util.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 940302e6f..ca0d4426b 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -1095,7 +1095,7 @@ int ioprio_parse_priority(const char *s, int *ret) { static pid_t cached_pid = CACHED_PID_UNSET; -static void reset_cached_pid(void) { +void reset_cached_pid(void) { /* Invoked in the child after a fork(), i.e. at the first moment the PID changed */ cached_pid = CACHED_PID_UNSET; } diff --git a/src/basic/process-util.h b/src/basic/process-util.h index efefbee4a..1609c48df 100644 --- a/src/basic/process-util.h +++ b/src/basic/process-util.h @@ -161,6 +161,7 @@ int ioprio_parse_priority(const char *s, int *ret); #endif // 0 pid_t getpid_cached(void); +void reset_cached_pid(void); int must_be_root(void); -- 2.30.2