summaryrefslogtreecommitdiffabout
path: root/src/ctl.c
authorSergey Poznyakoff <gray@gnu.org>2016-01-31 11:43:18 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2016-01-31 11:43:18 (GMT)
commit6f9f2fd7a6952b544dccbf0bdc7f9c312f602afe (patch) (side-by-side diff)
tree8bf0b45bb6578dee844dc92c1a90a93474f0fa7a /src/ctl.c
parent7f20aa4f7e26d8f740b55bef98f0c3c78eca0e79 (diff)
downloadpies-6f9f2fd7a6952b544dccbf0bdc7f9c312f602afe.tar.gz
pies-6f9f2fd7a6952b544dccbf0bdc7f9c312f602afe.tar.bz2
Fix runlevel switching; handle powerfail commands.
* src/ctl.c (prog_serialize): List runlevels. * src/pies.c (main): Set got_alarm after reloading configuration. Handle ACTION_POWER. * src/pies.h (ACTION_POWER): New constant. (progman_running_p): Rename to progman_waiting_p. All uses changed. (sysvinit_power): New proto. (POWER_STAT_FILE): New define. (POWER_STAT_FAIL,POWER_STAT_LOW,POWER_STAT_OK): New constants. * src/prog.h (prog) <idx>: Remove. (prog) <wait>: New member. * src/progman.c (prog_lookup_by_idx): Remove. (progman_waiting_p): Return 1 only if there is at least one prog with v.p.wait set. (prog_start): Initialize v.p.wait for sysvinit components. (progman_start): Don't do anything if waiting for components from the previous runlevel. (progman_wake_sleeping): Likewise. (progman_cleanup): Assume expect_term if waiting for components from the previous runlevel. Clear v.p.wait on exited progs. * src/sysvinit.c (sysvinit_fifo_handler): Don't call progman_stop when handling runlevel changes. Handle INIT_CMD_POWERFAIL, INIT_CMD_POWERFAILNOW, and INIT_CMD_POWEROK. (sysvinit_sigtrans): Handle SIGPWR. (is_comp_wait): Rewrite. (power_stat_file): New variable. (sysvinit_power): New function.
Diffstat (limited to 'src/ctl.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/ctl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ctl.c b/src/ctl.c
index d3e6b64..0e5ea97 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -1826,7 +1826,9 @@ prog_serialize (struct json_value *ret, struct prog *prog)
+ if (prog->v.p.comp->runlevels)
+ json_object_set_string (ret, "runlevels", "%s",
+ prog->v.p.comp->runlevels);
+
if (prog->v.p.status == status_sleeping)
- {
- json_object_set_number (ret, "wakeup-time",
- prog->v.p.timestamp + SLEEPTIME);
- }
+ json_object_set_number (ret, "wakeup-time",
+ prog->v.p.timestamp + SLEEPTIME);

Return to:

Send suggestions and report system problems to the System administrator.