From 3018420f7fd004b48715100d2f60b27c64d48b75 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 24 Jun 2013 18:31:51 +0200 Subject: add respawn support https://dev.openwrt.org/ticket/13751 Signed-off-by: John Crispin --- inittab.c | 13 +++++++++++++ state.c | 1 + 2 files changed, 14 insertions(+) diff --git a/inittab.c b/inittab.c index 2ed1395..686d389 100644 --- a/inittab.c +++ b/inittab.c @@ -175,6 +175,15 @@ err_out: regfree(&pat_cmdline); } +static void rcrespawn(struct init_action *a) +{ + a->tout.cb = respawn; + a->respawn = 500; + + a->proc.cb = child_exit; + fork_worker(a); +} + static struct init_handler handlers[] = { { .name = "sysinit", @@ -190,6 +199,10 @@ static struct init_handler handlers[] = { .name = "askconsole", .cb = askconsole, .multi = 1, + }, { + .name = "respawn", + .cb = rcrespawn, + .multi = 1, } }; diff --git a/state.c b/state.c index 8fe931e..618d758 100644 --- a/state.c +++ b/state.c @@ -50,6 +50,7 @@ static void state_enter(void) log_init(); procd_connect_ubus(); procd_inittab(); + procd_inittab_run("respawn"); procd_inittab_run("askconsole"); procd_inittab_run("askfirst"); procd_inittab_run("sysinit"); -- cgit v1.2.3