aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-01-30 14:52:52 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-01-30 14:52:52 +0200
commit7f20aa4f7e26d8f740b55bef98f0c3c78eca0e79 (patch)
treec32e862b002c167a36f4d0f0f1fb9a2f6d626d68
parente9379677a3c82753f0d29ef1c3490eec345db3c0 (diff)
downloadpies-7f20aa4f7e26d8f740b55bef98f0c3c78eca0e79.tar.gz
pies-7f20aa4f7e26d8f740b55bef98f0c3c78eca0e79.tar.bz2
Fix configuration reload and telinit q
* src/comp.c (component_link): Always link after the REF. component. If REF is NULL, link at list head. (component_append): New function. (component_create): Use component_append. (component_free): Fix double-free. * src/pies.c (pies_reload): Call sysvinit_runlevel_setup. * src/progman.c (progman_stop_component): Remove inactive components. * src/sysvinit.c (sysvinit_fifo_handler): Schedule ACTION_RELOAD. on receiving INIT_CMD_RUNLVL. (sysvinit_sigtrans): Don't handle SIGHUP.
-rw-r--r--src/comp.c25
-rw-r--r--src/pies.c2
-rw-r--r--src/progman.c12
-rw-r--r--src/sysvinit.c9
4 files changed, 35 insertions, 13 deletions
diff --git a/src/comp.c b/src/comp.c
index 539db93..5613e28 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -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->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);
diff --git a/src/pies.c b/src/pies.c
index d3a9096..1bce1eb 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -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:
+ 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,2 +2384,5 @@ progman_stop_component (struct prog *prog)
default:
+ if (!component_is_active (prog->v.p.comp))
+ destroy_prog (&prog);
+ else
logmsg (LOG_INFO,
diff --git a/src/sysvinit.c b/src/sysvinit.c
index a4e0d63..d8b7cc5 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -449,2 +449,9 @@ sysvinit_fifo_handler (int fd, void *data)
buf.req.runlevel = toupper (buf.req.runlevel);
+ pies_schedule_action (ACTION_RELOAD);
+ switch (buf.req.runlevel)
+ {
+ case 'Q':
+ break;
+
+ default:
if (buf.req.runlevel != runlevel)
@@ -455,2 +462,3 @@ sysvinit_fifo_handler (int fd, void *data)
}
+ }
break;
@@ -564,3 +572,2 @@ sysvinit_sigtrans (int sig, int *pact)
case SIGQUIT:
- case SIGHUP:
/* Ignore these signals. */

Return to:

Send suggestions and report system problems to the System administrator.