procd: service_stop_all: also kill inittab actions
[project/procd.git] / inittab.c
index b2ffc9a25e5fc69aa6a581002331c3ab93c1cc3f..128268a03fdbd2163210007a555a8bfe2ef82dee 100644 (file)
--- a/inittab.c
+++ b/inittab.c
@@ -123,6 +123,9 @@ static void child_exit(struct uloop_process *proc, int ret)
        DEBUG(4, "pid:%d, exitcode:%d\n", proc->pid, ret);
        proc->pid = 0;
 
+       if (a->respawn < 0)
+               return;
+
        if (!dev_exist(a->id)) {
                DEBUG(4, "Skipping respawn: device '%s' does not exist anymore\n", a->id);
                return;
@@ -293,6 +296,17 @@ void procd_inittab_run(const char *handler)
                }
 }
 
+void procd_inittab_kill(void)
+{
+       struct init_action *a;
+
+       list_for_each_entry(a, &actions, list) {
+               a->respawn = -1;
+               if (a->proc.pid)
+                       kill(a->proc.pid, SIGKILL);
+       }
+}
+
 void procd_inittab(void)
 {
 #define LINE_LEN       128