aboutsummaryrefslogtreecommitdiff
path: root/src/sysvinit.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2014-06-11 09:34:15 +0300
committerSergey Poznyakoff <gray@gnu.org>2014-06-11 09:36:00 +0300
commit7284aa23593651e26ab726d375487d3fc55a6863 (patch)
tree56a81c95ad5fd51072275f762476eaa589c28768 /src/sysvinit.c
parentcf4ab27d35038a7e4b1d5db119729c142b15abb7 (diff)
downloadpies-7284aa23593651e26ab726d375487d3fc55a6863.tar.gz
pies-7284aa23593651e26ab726d375487d3fc55a6863.tar.bz2
Init emulator mode; bugfix.
* src/pies.c (main) [INIT_EMU]: Enable "init emulator" mode. * src/sysvinit.c (enablecomp) (sysvinit_runlevel_setup): Use struct enstate to pass information to the callback. This fixes bug introduced by the previous commit, which caused "wait" keyword to be ignored.
Diffstat (limited to 'src/sysvinit.c')
-rw-r--r--src/sysvinit.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/sysvinit.c b/src/sysvinit.c
index b2975d3..7e0dba6 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -207,22 +207,19 @@ runlevel_index (int n)
return p - valid_runlevels;
}
+struct enstate
+{
+ int mask;
+ int wait;
+};
+
static int
enablecomp (struct prog *prog, void *data)
{
- int *mask = data;
- int wait;
+ struct enstate *s = data;
int rc;
struct component *comp = prog->v.p.comp;
- if (mask)
- {
- wait = *mask & PIES_COMP_WAIT;
- *mask &= ~PIES_COMP_WAIT;
- }
- else
- wait = 0;
-
switch (boot_state)
{
case sysinit:
@@ -246,21 +243,21 @@ enablecomp (struct prog *prog, void *data)
case pies_comp_ondemand:
case pies_comp_powerfailnow:
case pies_comp_kbrequest:
- return mask && (*mask & PIES_COMP_MASK (comp->mode));
+ return s && (s->mask & PIES_COMP_MASK (comp->mode));
default:
break;
- }
+ }
}
rc = !!strchr (comp->runlevels, runlevel);
if (!rc)
return rc;
if (prog->v.p.status == status_finished)
return -1;
- if (wait)
+ if (s && s->mask & PIES_COMP_WAIT)
{
if (comp->mode == pies_comp_wait)
{
- *mask |= PIES_COMP_WAIT;
+ s->wait = 1;
return 1;
}
return 0;
@@ -290,11 +287,16 @@ runlevel_setup_prog (struct prog *prog, void *data)
void
sysvinit_runlevel_setup (int mask, int *wait)
{
+ struct enstate s;
+ s.mask = mask;
if (wait)
- mask |= PIES_COMP_WAIT;
- progman_foreach (runlevel_setup_prog, &mask);
+ {
+ s.mask |= PIES_COMP_WAIT;
+ s.wait = *wait;
+ }
+ progman_foreach (runlevel_setup_prog, &s);
if (wait)
- *wait = mask & PIES_COMP_WAIT;
+ *wait = s.wait;
}
static const char valid_runlevel_arg[] = "0123456789SsQqAaBbCcUu";
@@ -650,11 +652,11 @@ inittrans ()
}
if (newlevel && newlevel != runlevel)
{
- debug (1, ("RL TRANS: %c -> %c", runlevel, newlevel));
+ prevlevel = runlevel ? runlevel : 'N';
+ debug (1, ("RL TRANS: %c -> %c", prevlevel, newlevel));
sysvinit_acct (SYSV_ACCT_RUNLEVEL, "runlevel", "~~",
newlevel + 256 * runlevel, "~");
mf_proctitle_format ("init [%c]", newlevel);
- prevlevel = runlevel ? runlevel : 'N';
runlevel = newlevel;
trans = 1;
wait = 0;

Return to:

Send suggestions and report system problems to the System administrator.