chiark / gitweb /
Modernization
[elogind.git] / src / core / killall.c
index 5f589eaf47430dec365f932fbe9fcec23f0d62e8..1eb3766f777a81d3dd566794df15541dd49d1bfe 100644 (file)
@@ -139,6 +139,13 @@ static int killall(int sig) {
                 if (ignore_proc(pid))
                         continue;
 
+                if (sig == SIGKILL) {
+                        _cleanup_free_ char *s;
+
+                        get_process_comm(pid, &s);
+                        log_notice("Sending SIGKILL to PID %lu (%s)", (unsigned long) pid, strna(s));
+                }
+
                 if (kill(pid, sig) >= 0)
                         n_processes++;
                 else if (errno != ENOENT)
@@ -150,7 +157,7 @@ static int killall(int sig) {
         return n_processes;
 }
 
-void broadcast_signal(int sig) {
+void broadcast_signal(int sig, bool wait_for_exit) {
         sigset_t mask, oldmask;
         int n_processes;
 
@@ -169,7 +176,8 @@ void broadcast_signal(int sig) {
         if (n_processes <= 0)
                 goto finish;
 
-        wait_for_children(n_processes, &mask);
+        if (wait_for_exit)
+                wait_for_children(n_processes, &mask);
 
 finish:
         sigprocmask(SIG_SETMASK, &oldmask, NULL);