summaryrefslogtreecommitdiff
path: root/src/activate
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-07-20 16:19:18 +0200
committerLennart Poettering <lennart@poettering.net>2017-07-20 20:27:24 +0200
commitdf0ff127758809a45105893772de76082d12a26d (patch)
tree9deb3a960cf26b54beae6a0b60d376c6ba8efe9a /src/activate
parent5c30a6d2b805ae9b5dd0ad003b9ee86b8965bc47 (diff)
downloadsystemd-df0ff127758809a45105893772de76082d12a26d.tar.gz
tree-wide: make use of getpid_cached() wherever we can
This moves pretty much all uses of getpid() over to getpid_raw(). I didn't specifically check whether the optimization is worth it for each replacement, but in order to keep things simple and systematic I switched over everything at once.
Diffstat (limited to 'src/activate')
-rw-r--r--src/activate/activate.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/activate/activate.c b/src/activate/activate.c
index 6ebd820410..4b82dca491 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -31,6 +31,7 @@
#include "fd-util.h"
#include "log.h"
#include "macro.h"
+#include "process-util.h"
#include "signal-util.h"
#include "socket-util.h"
#include "string-util.h"
@@ -221,7 +222,7 @@ static int exec_process(const char* name, char **argv, char **env, int start_fd,
if (asprintf((char**)(envp + n_env++), "LISTEN_FDS=%i", n_fds) < 0)
return log_oom();
- if (asprintf((char**)(envp + n_env++), "LISTEN_PID=" PID_FMT, getpid()) < 0)
+ if (asprintf((char**)(envp + n_env++), "LISTEN_PID=" PID_FMT, getpid_cached()) < 0)
return log_oom();
if (arg_fdnames) {
@@ -271,7 +272,7 @@ static int fork_and_exec_process(const char* child, char** argv, char **env, int
if (!joined)
return log_oom();
- parent_pid = getpid();
+ parent_pid = getpid_cached();
child_pid = fork();
if (child_pid < 0)