Merge pull request #2441 from msekletar/killing-spree-excluded-log-v3

shutdown: complain if process excluded from killing spree runs of the same rootfs as PID1 (v3)
This commit is contained in:
Lennart Poettering
2016-01-26 14:50:43 +01:00
4 changed files with 31 additions and 7 deletions
+12
View File
@@ -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;
+1
View File
@@ -70,6 +70,7 @@ int getenv_for_pid(pid_t pid, const char *field, char **_value);
bool pid_is_alive(pid_t pid);
bool pid_is_unwaited(pid_t pid);
int pid_from_same_root_fs(pid_t pid);
bool is_main_thread(void);