summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-26 01:13:11 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-26 01:24:39 +0100
commit4d0d3d41d21f34f28ee67b8b1952af88ada7abaf (patch)
tree82303ad33953a655b9eaa75324e929a38146dff8 /src/basic
parent2583fbea8e762d2e915582af60560f884d5093f5 (diff)
process-util: move more process related calls to process-util.[ch]
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/process-util.c10
-rw-r--r--src/basic/process-util.h3
-rw-r--r--src/basic/util.c10
-rw-r--r--src/basic/util.h4
4 files changed, 13 insertions, 14 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 65c93792fb..72fc82e7cb 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -480,6 +480,16 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_cod
return -EPROTO;
}
+void sigkill_wait(pid_t *pid) {
+ if (!pid)
+ return;
+ if (*pid <= 1)
+ return;
+
+ if (kill(*pid, SIGKILL) > 0)
+ (void) wait_for_terminate(*pid, NULL);
+}
+
int kill_and_sigcont(pid_t pid, int sig) {
int r;
diff --git a/src/basic/process-util.h b/src/basic/process-util.h
index 07431d043b..2c0d1af000 100644
--- a/src/basic/process-util.h
+++ b/src/basic/process-util.h
@@ -55,6 +55,9 @@ int get_process_environ(pid_t pid, char **environ);
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);
+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]);
diff --git a/src/basic/util.c b/src/basic/util.c
index 2129d46aef..d5227aa6d0 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -4016,16 +4016,6 @@ int read_attr_path(const char *p, unsigned *ret) {
return read_attr_fd(fd, ret);
}
-void sigkill_wait(pid_t *pid) {
- if (!pid)
- return;
- if (*pid <= 1)
- return;
-
- if (kill(*pid, SIGKILL) > 0)
- (void) wait_for_terminate(*pid, NULL);
-}
-
int syslog_parse_priority(const char **p, int *priority, bool with_facility) {
int a = 0, b = 0, c = 0;
int k;
diff --git a/src/basic/util.h b/src/basic/util.h
index 55b428fa63..f32033767a 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -92,7 +92,6 @@ int parse_size(const char *t, uint64_t base, uint64_t *size);
int parse_boolean(const char *v) _pure_;
int parse_pid(const char *s, pid_t* ret_pid);
-
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);
@@ -677,9 +676,6 @@ int read_attr_path(const char *p, unsigned *ret);
#define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim })
-void sigkill_wait(pid_t *pid);
-#define _cleanup_sigkill_wait_ _cleanup_(sigkill_wait)
-
int syslog_parse_priority(const char **p, int *priority, bool with_facility);
int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);