summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-27 14:01:48 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-27 14:01:48 +0100
commit6bc73acb01e2782f0ef3ec70dde3dc3f5b5da081 (patch)
treeee1deb8ffaa6ab0b293a331973b562ea5c7a842c
parent405f8907b9da158b8548a4d9b85871406fcc2801 (diff)
process-util: rename get_parent_of_pid() → get_process_ppid()
In order to match the other get_process_xyz() calls.
-rw-r--r--src/basic/process-util.c2
-rw-r--r--src/basic/process-util.h2
-rw-r--r--src/core/cgroup.c2
-rw-r--r--src/core/service.c2
-rw-r--r--src/test/test-process-util.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 31951cdd4f..0b7e3010e0 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -402,7 +402,7 @@ int get_process_environ(pid_t pid, char **env) {
return 0;
}
-int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
+int get_process_ppid(pid_t pid, pid_t *_ppid) {
int r;
_cleanup_free_ char *line = NULL;
long unsigned ppid;
diff --git a/src/basic/process-util.h b/src/basic/process-util.h
index 31f760981e..85fc8d8eb7 100644
--- a/src/basic/process-util.h
+++ b/src/basic/process-util.h
@@ -51,6 +51,7 @@ int get_process_capeff(pid_t pid, char **capeff);
int get_process_cwd(pid_t pid, char **cwd);
int get_process_root(pid_t pid, char **root);
int get_process_environ(pid_t pid, char **environ);
+int get_process_ppid(pid_t pid, pid_t *ppid);
int wait_for_terminate(pid_t pid, siginfo_t *status);
int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_code);
@@ -59,7 +60,6 @@ void sigkill_wait(pid_t *pid);
#define _cleanup_sigkill_wait_ _cleanup_(sigkill_wait)
int kill_and_sigcont(pid_t pid, int sig);
-pid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
void rename_process(const char name[8]);
int is_kernel_thread(pid_t pid);
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 90cee12be7..70f6d4af0f 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -1208,7 +1208,7 @@ int unit_search_main_pid(Unit *u, pid_t *ret) {
continue;
/* Ignore processes that aren't our kids */
- if (get_parent_of_pid(npid, &ppid) >= 0 && ppid != mypid)
+ if (get_process_ppid(npid, &ppid) >= 0 && ppid != mypid)
continue;
if (pid != 0)
diff --git a/src/core/service.c b/src/core/service.c
index 2d92799fec..31a0d3aebe 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -175,7 +175,7 @@ static int service_set_main_pid(Service *s, pid_t pid) {
s->main_pid = pid;
s->main_pid_known = true;
- if (get_parent_of_pid(pid, &ppid) >= 0 && ppid != getpid()) {
+ if (get_process_ppid(pid, &ppid) >= 0 && ppid != getpid()) {
log_unit_warning(UNIT(s), "Supervising process "PID_FMT" which is not our child. We'll most likely not notice when it exits.", pid);
s->main_pid_alien = true;
} else
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
index fa448348da..48be5a3a87 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -55,7 +55,7 @@ static void test_get_process_comm(void) {
assert_se(get_process_cmdline(1, 8, false, &d) >= 0);
log_info("pid1 cmdline truncated: '%s'", d);
- assert_se(get_parent_of_pid(1, &e) >= 0);
+ assert_se(get_process_ppid(1, &e) >= 0);
log_info("pid1 ppid: "PID_FMT, e);
assert_se(e == 0);