diff options
-rw-r--r-- | src/comp.c | 27 | ||||
-rw-r--r-- | src/pies.c | 2 | ||||
-rw-r--r-- | src/progman.c | 22 | ||||
-rw-r--r-- | src/sysvinit.c | 23 |
4 files changed, 48 insertions, 26 deletions
@@ -47,3 +47,3 @@ prev_index (void) void -component_link (struct component *comp, struct component *ref, int before) +component_link (struct component *comp, struct component *ref) { @@ -53,12 +53,10 @@ component_link (struct component *comp, struct component *ref, int before) - comp->next = NULL; - comp->prev = list->tail; - if (list->tail) - list->tail->next = comp; + comp->prev = NULL; + comp->next = list->head; + if (list->head) + list->head->prev = comp; else - list->head = comp; - list->tail = comp; + list->tail = comp; + list->head = comp; } - else if (before) - component_link (comp, ref->prev, 0); else @@ -83,2 +81,8 @@ component_link (struct component *comp, struct component *ref, int before) void +component_append (struct component *comp) +{ + component_link (comp, comp_list[comp->listidx].tail); +} + +void component_unlink (struct component *comp) @@ -134,3 +138,3 @@ component_create (const char *name) comp->socket_type = SOCK_STREAM; - component_link (comp, NULL, 0); + component_append (comp); } @@ -166,3 +170,2 @@ component_free (struct component *comp) free_limits (comp->limits); - free (comp->runlevels); free (comp->service); @@ -489,3 +492,3 @@ component_config_commit (void) match->listidx = cur; - component_link (match, comp, 1); + component_link (match, comp->prev); component_free (comp); @@ -1537,2 +1537,4 @@ pies_reload (void) component_config_commit (); + if (init_process) + sysvinit_runlevel_setup (PIES_COMP_DEFAULT, NULL); progman_create_sockets (); diff --git a/src/progman.c b/src/progman.c index 4f63d9a..3bbd8b3 100644 --- a/src/progman.c +++ b/src/progman.c @@ -2364,3 +2364,5 @@ progman_stop_component (struct prog *prog) case status_disabled: - if (!(prog->v.p.comp->flags & CF_DISABLED)) + if (!component_is_active (prog->v.p.comp)) + destroy_prog (&prog); + else if (!(prog->v.p.comp->flags & CF_DISABLED)) { @@ -2372,4 +2374,9 @@ progman_stop_component (struct prog *prog) case status_sleeping: - logmsg (LOG_INFO, _("waking up component `%s'"), prog_tag (prog)); - prog->v.p.failcount = 0; + if (!component_is_active (prog->v.p.comp)) + destroy_prog (&prog); + else + { + logmsg (LOG_INFO, _("waking up component `%s'"), prog_tag (prog)); + prog->v.p.failcount = 0; + } break; @@ -2377,5 +2384,8 @@ progman_stop_component (struct prog *prog) default: - logmsg (LOG_INFO, - _("stopping component `%s': component not started"), - prog_tag (prog)); + if (!component_is_active (prog->v.p.comp)) + destroy_prog (&prog); + else + logmsg (LOG_INFO, + _("stopping component `%s': component not started"), + prog_tag (prog)); } diff --git a/src/sysvinit.c b/src/sysvinit.c index a4e0d63..d8b7cc5 100644 --- a/src/sysvinit.c +++ b/src/sysvinit.c @@ -449,9 +449,17 @@ sysvinit_fifo_handler (int fd, void *data) buf.req.runlevel = toupper (buf.req.runlevel); - if (buf.req.runlevel != runlevel) - { - progman_stop (); - dfl_level = buf.req.runlevel; - inittrans (); - } - break; + pies_schedule_action (ACTION_RELOAD); + switch (buf.req.runlevel) + { + case 'Q': + break; + + default: + if (buf.req.runlevel != runlevel) + { + progman_stop (); + dfl_level = buf.req.runlevel; + inittrans (); + } + } + break; @@ -564,3 +572,2 @@ sysvinit_sigtrans (int sig, int *pact) case SIGQUIT: - case SIGHUP: /* Ignore these signals. */ |