diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-02-13 21:27:11 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-02-13 21:46:32 +0200 |
commit | c9581808b72ff25623c87cf49c471ce7f017985d (patch) | |
tree | 3b6c7143eec966561e24c05ffb87e1d55b4acf58 /src/piesctl.c | |
parent | 3c774556e22cd30c42304614e14218a767e4d700 (diff) | |
download | pies-c9581808b72ff25623c87cf49c471ce7f017985d.tar.gz pies-c9581808b72ff25623c87cf49c471ce7f017985d.tar.bz2 |
Stop disabled components when switching runlevels.
* src/prog.h (status_enabled, status_disabled): Remove.
(status_stopped, status_running): New modes.
All uses updated.
* src/comp.c (component_finish): Disable ondemand component
by default.
* src/ctl.c (json_object_set_bool): New function.
(pies_status_str): Update.
(prog_serialize): Set "disabled" attribute.
(fun_stop, fun_start): Use CF_DISABLED flag.
(res_runlevel): Schedule ACTION_RELOAD.
* src/pies.h (json_object_set_bool): New proto.
* src/piesctl.c (status_trans): Reflect changes in modes.
(print_comp): Check the "disabled" attribute.
* src/progman.c (register_prog0)
(prog_open_socket,prog_start,prog_stop)
(progman_wake_sleeping)
(prog_start_prerequisites)
(react, progman_cleanup)
(progman_stop_component): Update.
(no_children_left): Fix.
* src/sysvinit.c (enablecomp): Make CF_DISABLED flag
persist for ondemand components.
(runlevel_setup_prog): Use CF_DISABLED flag.
(inittrans): Stop inactivated processes.
* doc/pies.texi: Update.
Diffstat (limited to 'src/piesctl.c')
-rw-r--r-- | src/piesctl.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/piesctl.c b/src/piesctl.c index d6a39a2..5f26aec 100644 --- a/src/piesctl.c +++ b/src/piesctl.c @@ -1075,8 +1075,8 @@ struct kwtrans mode_trans[] = { }; struct kwtrans status_trans[] = { - { "enabled", 'R' }, - { "disabled", 'D' }, + { "running", 'R' }, + { "stopped", 'T' }, { "listener", 'L' }, { "sleeping", 's' }, { "stopping", 'S' }, @@ -1159,15 +1159,21 @@ print_comp (FILE *fp, struct json_value *v, size_t n) if (strcmp (type, "component") == 0) { p = getval (v, "mode", json_string, 0); - if (v) + if (p) fbuf[fidx++] = kwtoc (p->v.s, mode_trans); else fbuf[fidx++] = '-'; - p = getval (v, "status", json_string, 0); - if (p) - fbuf[fidx++] = status = kwtoc (p->v.s, status_trans); - else + p = getval (v, "disabled", json_bool, 0); + if (p && p->v.b) fbuf[fidx++] = '-'; + else + { + p = getval (v, "status", json_string, 0); + if (p) + fbuf[fidx++] = status = kwtoc (p->v.s, status_trans); + else + fbuf[fidx++] = '-'; + } } else if (strcmp (type, "redirector") == 0) { |