summaryrefslogtreecommitdiff
path: root/src/basic/process-util.c
diff options
context:
space:
mode:
authorMichal Sekletar <msekleta@redhat.com>2016-01-24 16:08:36 +0100
committerMichal Sekletar <msekleta@redhat.com>2016-01-26 14:13:13 +0100
commit1359fffa573f42463e3b369df5e57b0c33821a61 (patch)
treeaaad55627476a203951b218db9d971a3dcf35fd2 /src/basic/process-util.c
parentafb3e6335a7e75afa24db9dff6860f45f0fcc940 (diff)
downloadsystemd-1359fffa573f42463e3b369df5e57b0c33821a61.tar.gz
shutdown: complain if process excluded from killing spree runs of the same rootfs as PID1
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r--src/basic/process-util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 4341d0093f..189ef9ab60 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -48,6 +48,7 @@
#include "missing.h"
#include "process-util.h"
#include "signal-util.h"
+#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "user-util.h"
@@ -637,6 +638,17 @@ bool pid_is_alive(pid_t pid) {
return true;
}
+int pid_from_same_root_fs(pid_t pid) {
+ const char *root;
+
+ if (pid < 0)
+ return 0;
+
+ root = procfs_file_alloca(pid, "root");
+
+ return files_same(root, "/proc/1/root");
+}
+
bool is_main_thread(void) {
static thread_local int cached = 0;