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;
+ }
+
uloop_timeout_set(&a->tout, a->respawn);
}
}
a->tout.cb = respawn;
- for (i = MAX_ARGS - 1; i >= 1; i--)
- a->argv[i] = a->argv[i - 1];
- a->argv[0] = ask;
+ /* shift arguments only if not yet done */
+ if (a->argv[0] != ask) {
+ for (i = MAX_ARGS - 1; i >= 1; i--)
+ a->argv[i] = a->argv[i - 1];
+ a->argv[0] = ask;
+ }
a->respawn = 500;
a->proc.cb = child_exit;
char line[256], *tty, *split;
int i;
+ /* First, try console= on the kernel command line,
+ * then fallback to /sys/class/tty/console/active,
+ * which should work when linux,stdout-path (or equivalent)
+ * is in the device tree
+ */
tty = get_cmdline_val("console", line, sizeof(line));
+ if (tty == NULL) {
+ if (dev_exist("console"))
+ tty = "console";
+ else
+ tty = get_active_console(line, sizeof(line));
+ }
if (tty != NULL) {
split = strchr(tty, ',');
if (split != NULL)
}
a->tout.cb = respawn;
- for (i = MAX_ARGS - 1; i >= 1; i--)
- a->argv[i] = a->argv[i - 1];
- a->argv[0] = ask;
+ /* shift arguments only if not yet done */
+ if (a->argv[0] != ask) {
+ for (i = MAX_ARGS - 1; i >= 1; i--)
+ a->argv[i] = a->argv[i - 1];
+ a->argv[0] = ask;
+ }
a->respawn = 500;
a->proc.cb = child_exit;
list_for_each_entry(a, &actions, list)
if (!strcmp(a->handler->name, handler)) {
- if (a->handler->multi) {
- a->handler->cb(a);
- continue;
- }
a->handler->cb(a);
- break;
+ if (!a->handler->multi)
+ break;
}
}
+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