From: Lennart Poettering Date: Fri, 29 Dec 2017 15:45:04 +0000 (+0100) Subject: raw-clone: beef up raw_clone() wrapper a bit X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0fc53d6e8f168fb120f4f9247fd1d502086ba490;p=elogind.git 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. --- 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);