summaryrefslogtreecommitdiffabout
path: root/src/sysvinit.c
Unidiff
Diffstat (limited to 'src/sysvinit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/sysvinit.c90
1 files changed, 69 insertions, 21 deletions
diff --git a/src/sysvinit.c b/src/sysvinit.c
index be7aef8..337b922 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -240,2 +240,6 @@ enablecomp (struct prog *prog, void *data)
240 return 0; 240 return 0;
241
242 case pies_comp_ondemand:
243 return prog->v.p.status == status_enabled;
244
241 case pies_comp_powerfail: 245 case pies_comp_powerfail:
@@ -244,3 +248,2 @@ enablecomp (struct prog *prog, void *data)
244 case pies_comp_ctrlaltdel: 248 case pies_comp_ctrlaltdel:
245 case pies_comp_ondemand:
246 case pies_comp_powerfailnow: 249 case pies_comp_powerfailnow:
@@ -302,3 +305,24 @@ sysvinit_runlevel_setup (int mask, int *wait)
302} 305}
303 306
307static int
308demand_prog (struct prog *prog, void *data)
309{
310 int *rl = data;
311 struct component *comp = prog->v.p.comp;
312 if (comp->mode == pies_comp_ondemand
313 && comp->runlevels
314 && strchr (comp->runlevels, *rl))
315 {
316 prog->v.p.status = status_enabled;
317 debug (1, ("%s: %s", prog_tag (prog), "enabled"));
318 }
319 return 0;
320}
321
322static void
323sysvinit_demand (int rl)
324{
325 progman_foreach (demand_prog, &rl);
326}
327
304static const char valid_runlevel_arg[] = "0123456789SsQqAaBbCcUu"; 328static const char valid_runlevel_arg[] = "0123456789SsQqAaBbCcUu";
@@ -460,4 +484,17 @@ sysvinit_fifo_handler (int fd, void *data)
460 { 484 {
461 dfl_level = buf.req.runlevel; 485 switch (buf.req.runlevel)
462 inittrans (); 486 {
487 case 'A':
488 case 'B':
489 case 'C':
490 sysvinit_demand (buf.req.runlevel);
491 break;
492
493 default:
494 if (runlevel_index (buf.req.runlevel) != -1)
495 {
496 dfl_level = buf.req.runlevel;
497 inittrans ();
498 }
499 }
463 } 500 }
@@ -821,15 +858,15 @@ struct action_parser
821static struct action_parser action_tab[] = { 858static struct action_parser action_tab[] = {
822 { "wait", pies_comp_wait }, 859 { "wait", pies_comp_wait },
823 { "once", pies_comp_once }, 860 { "once", pies_comp_once },
824 { "boot", pies_comp_boot }, 861 { "boot", pies_comp_boot },
825 { "bootwait", pies_comp_bootwait }, 862 { "bootwait", pies_comp_bootwait },
826 { "powerfail", pies_comp_powerfail }, 863 { "powerfail", pies_comp_powerfail },
827 { "powerwait", pies_comp_powerwait }, 864 { "powerwait", pies_comp_powerwait },
828 { "powerokwait", pies_comp_powerokwait }, 865 { "powerokwait", pies_comp_powerokwait },
829 { "ctrlaltdel", pies_comp_ctrlaltdel }, 866 { "ctrlaltdel", pies_comp_ctrlaltdel },
830 { "ondemand", pies_comp_ondemand }, 867 { "ondemand", pies_comp_ondemand },
831 { "sysinit", pies_comp_sysinit }, 868 { "sysinit", pies_comp_sysinit },
832 { "powerfailnow", pies_comp_powerfailnow }, 869 { "powerfailnow", pies_comp_powerfailnow },
833 { "kbrequest", pies_comp_kbrequest }, 870 { "kbrequest", pies_comp_kbrequest },
834 { "respawn", pies_comp_respawn }, 871 { "respawn", pies_comp_respawn },
835 { NULL } 872 { NULL }
@@ -848,2 +885,11 @@ find_action_parser (const char *action)
848 885
886static char *
887strupr (char *s)
888{
889 char *p;
890 for (p = s; *p; p++)
891 *p = toupper (*p);
892 return s;
893}
894
849int 895int
@@ -933,4 +979,3 @@ inittab_parse (const char *file)
933 { 979 {
934 logmsg (LOG_ERR, "%s:%u: %s", 980 logmsg (LOG_ERR, "%s:%u: %s", file, line_no, _("not enough fields"));
935 file, line_no, _("not enough fields"));
936 err = 1; 981 err = 1;
@@ -952,2 +997,6 @@ inittab_parse (const char *file)
952 997
998 if (strcmp (action, "off") == 0)
999 /* Ignore the entry */
1000 continue;
1001
953 ap = find_action_parser (action); 1002 ap = find_action_parser (action);
@@ -955,4 +1004,3 @@ inittab_parse (const char *file)
955 { 1004 {
956 logmsg (LOG_ERR, "%s:%u: %s", 1005 logmsg (LOG_ERR, "%s:%u: %s", file, line_no, _("unknown action"));
957 file, line_no, _("unknown action"));
958 err = 1; 1006 err = 1;
@@ -963,3 +1011,3 @@ inittab_parse (const char *file)
963 comp->mode = ap->mode; 1011 comp->mode = ap->mode;
964 comp->runlevels = grecs_strdup (runlevels); 1012 comp->runlevels = grecs_strdup (strupr (runlevels));
965 1013

Return to:

Send suggestions and report system problems to the System administrator.