summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/comp.c41
-rw-r--r--src/ctl.c4
-rw-r--r--src/piesctl.c4
-rw-r--r--src/prog.h2
-rw-r--r--src/progman.c19
5 files changed, 26 insertions, 44 deletions
diff --git a/src/comp.c b/src/comp.c
index 2346306..25f2657 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -24,11 +24,6 @@ struct complist
24 struct component *tail; 24 struct component *tail;
25}; 25};
26 26
27/* 0 on the first load, and 1 on all subsequent reloads. Tells the
28 component_config_commit whether we're starting from scratch or just
29 updating an already loaded configuration */
30static int loaded;
31
32static struct complist comp_list[2]; 27static struct complist comp_list[2];
33static int cur; 28static int cur;
34 29
@@ -540,35 +535,21 @@ component_config_commit (void)
540 comp_count = i; 535 comp_count = i;
541 536
542 /* Rearrange components, registering entries for the new ones */ 537 /* Rearrange components, registering entries for the new ones */
543 for (comp = list->head, i = 0; comp; ) 538 for (comp = list->head, i = 0; comp; comp = comp->next, i++)
544 { 539 {
545 struct component *next = comp->next; 540 match = complist_find_match (prev, comp);
546 if (loaded && comp->mode == pies_comp_startup) 541 if (match)
547 { 542 {
548 /* Ignore startup components */ 543 component_merge (match, comp);
549 component_unlink (comp); 544 component_unlink (match);
545 match->listidx = cur;
546 component_link (match, comp->prev);
550 component_free (comp); 547 component_free (comp);
548 comp = match;
551 } 549 }
552 else 550 comp_array[i] = comp;
553 { 551 comp->arridx = i;
554 match = complist_find_match (prev, comp);
555 if (match)
556 {
557 component_merge (match, comp);
558 component_unlink (match);
559 match->listidx = cur;
560 component_link (match, comp->prev);
561 component_free (comp);
562 comp = match;
563 }
564 comp_array[i] = comp;
565 comp->arridx = i;
566 i++;
567 }
568 comp = next;
569 } 552 }
570 /* Adjust comp_count */
571 comp_count = i;
572 553
573 /* Mark orphaned progs for termination */ 554 /* Mark orphaned progs for termination */
574 list = &comp_list[prev]; 555 list = &comp_list[prev];
@@ -585,8 +566,6 @@ component_config_commit (void)
585 for (comp = comp_list[cur].head; comp; comp = comp->next) 566 for (comp = comp_list[cur].head; comp; comp = comp->next)
586 if (!comp->prog) 567 if (!comp->prog)
587 register_prog (comp); 568 register_prog (comp);
588
589 loaded = 1;
590} 569}
591 570
592static int 571static int
diff --git a/src/ctl.c b/src/ctl.c
index a78cdbf..d9a8998 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -1453,7 +1453,9 @@ static char * const pies_comp_mode_str[] = {
1453 [pies_comp_exec] = "exec", 1453 [pies_comp_exec] = "exec",
1454 [pies_comp_accept] = "accept", 1454 [pies_comp_accept] = "accept",
1455 [pies_comp_inetd] = "inetd", 1455 [pies_comp_inetd] = "inetd",
1456 [pies_comp_pass_fd] = "pass_fd", 1456 [pies_comp_pass_fd] = "pass_fd",
1457 [pies_comp_startup] = "startup",
1458 [pies_comp_shutdown] = "shutdown",
1457 [pies_comp_wait] = "wait", 1459 [pies_comp_wait] = "wait",
1458 [pies_comp_once] = "once", 1460 [pies_comp_once] = "once",
1459 [pies_comp_boot] = "boot", 1461 [pies_comp_boot] = "boot",
diff --git a/src/piesctl.c b/src/piesctl.c
index f2e774b..0cd2736 100644
--- a/src/piesctl.c
+++ b/src/piesctl.c
@@ -1052,7 +1052,9 @@ struct kwtrans mode_trans[] = {
1052 { "exec", 'C' }, 1052 { "exec", 'C' },
1053 { "accept", 'A' }, 1053 { "accept", 'A' },
1054 { "inetd", 'I' }, 1054 { "inetd", 'I' },
1055 { "pass_fd", 'P' }, 1055 { "pass_fd", 'P' },
1056 { "startup", 'S' },
1057 { "shutdown", 'E' },
1056 { "wait", 'W' }, 1058 { "wait", 'W' },
1057 { "once", 'c' }, 1059 { "once", 'c' },
1058 { "boot", 'B' }, 1060 { "boot", 'B' },
diff --git a/src/prog.h b/src/prog.h
index 9a3960f..04cf3d0 100644
--- a/src/prog.h
+++ b/src/prog.h
@@ -29,7 +29,7 @@ enum prog_status
29 status_sleeping, /* Component is sleeping. An attempt to start it will 29 status_sleeping, /* Component is sleeping. An attempt to start it will
30 be made at prog->v.p.timestamp + SLEEPTIME */ 30 be made at prog->v.p.timestamp + SLEEPTIME */
31 status_stopping, /* Component is being stopped */ 31 status_stopping, /* Component is being stopped */
32 status_finished, /* A "once" component has finished */ 32 status_finished, /* A "once" or "startup" component has finished */
33 }; 33 };
34 34
35struct conn_class 35struct conn_class
diff --git a/src/progman.c b/src/progman.c
index 5bc4eb3..a625885 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -324,7 +324,8 @@ progman_startup_phase (void)
324 324
325 for (prog = proghead; prog; prog = prog->next) 325 for (prog = proghead; prog; prog = prog->next)
326 { 326 {
327 if (IS_COMPONENT (prog) && prog->v.p.comp->mode == pies_comp_startup) 327 if (IS_COMPONENT (prog) && prog->v.p.comp->mode == pies_comp_startup
328 && prog->v.p.status == status_running)
328 return 1; 329 return 1;
329 } 330 }
330 return 0; 331 return 0;
@@ -338,7 +339,7 @@ progman_waiting_p (void)
338 for (prog = proghead; prog; prog = prog->next) 339 for (prog = proghead; prog; prog = prog->next)
339 { 340 {
340 if (IS_COMPONENT (prog) 341 if (IS_COMPONENT (prog)
341 && prog->pid > 0 342 && prog->v.p.status == status_running
342 && (prog->wait || prog->v.p.comp->mode == pies_comp_startup)) 343 && (prog->wait || prog->v.p.comp->mode == pies_comp_startup))
343 { 344 {
344 debug (3, ("%s: waiting for %s (%lu)", 345 debug (3, ("%s: waiting for %s (%lu)",
@@ -2356,14 +2357,6 @@ progman_cleanup (int expect_term)
2356 } 2357 }
2357 destroy_prog (&prog); 2358 destroy_prog (&prog);
2358 } 2359 }
2359 else if (prog->v.p.comp->mode == pies_comp_startup)
2360 {
2361 debug (1, (_("removing startup component %s, pid=%lu"),
2362 prog_tag (prog), (unsigned long)pid));
2363 destroy_prog (&prog);
2364 if (!progman_startup_phase ())
2365 pies_schedule_children (PIES_CHLD_WAKEUP);
2366 }
2367 else 2360 else
2368 { 2361 {
2369 if (prog->v.p.comp->mode >= pies_mark_sysvinit 2362 if (prog->v.p.comp->mode >= pies_mark_sysvinit
@@ -2379,6 +2372,12 @@ progman_cleanup (int expect_term)
2379 prog->wait = 0; 2372 prog->wait = 0;
2380 } 2373 }
2381 } 2374 }
2375 else if (prog->v.p.comp->mode == pies_comp_startup)
2376 {
2377 prog->v.p.status = status_finished;
2378 if (!progman_startup_phase ())
2379 pies_schedule_children (PIES_CHLD_WAKEUP);
2380 }
2382 else 2381 else
2383 { 2382 {
2384 if (is_sysvinit (prog->v.p.comp)) 2383 if (is_sysvinit (prog->v.p.comp))

Return to:

Send suggestions and report system problems to the System administrator.