summaryrefslogtreecommitdiffabout
path: root/src/ctl.c
authorSergey Poznyakoff <gray@gnu.org>2016-02-16 05:15:42 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2016-02-16 05:15:42 (GMT)
commitbd8bd1640c72ceefd87b46a7a3d378c78c9081f5 (patch) (side-by-side diff)
tree8224d8dfd67ab70240744dfb2df4c3af9fd1f850 /src/ctl.c
parent27366c475aa4955f296f169cf9acd33e36b9d7b3 (diff)
downloadpies-bd8bd1640c72ceefd87b46a7a3d378c78c9081f5.tar.gz
pies-bd8bd1640c72ceefd87b46a7a3d378c78c9081f5.tar.bz2
Associate program's activity flag with prog, instead of with component.
The CF_DISABLED flag is still retained to indicate that the component is disabled administratively. * src/prog.h (prog.v.p) <active>: New member. (IS_ACTIVE_COMPONENT): Use active flag. * src/comp.c (component_finish): Don't modify component flags. * src/ctl.c (prog_serialize): Replace attribute "disabled" with "active". (fun_stop): Set prog->v.p.active * src/pies.c (main): Use pies_master_argv to check whether program name is absolute. * src/piesctl.c (print_comp): Check "active" attribute. * src/progman.c (register_prog0): Set prog->v.p.active. (progman_create_sockets): Remove components if their socket cannot be opened. (progman_lookup_tcpmux, prog_open_socket) (prog_start, progman_start) (prog_start_prerequisites, react): Operate on prog->v.p.active to test/change prog's activity state. * src/sysvinit.c (enablecomp, runlevel_setup_prog): Operate on prog->v.p.active to test/change prog's activity state. (demand_prog, IS_RUNNING_DISABLED_PROG): Likewise.
Diffstat (limited to 'src/ctl.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/ctl.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ctl.c b/src/ctl.c
index f4154f6..6e162e5 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -1829,8 +1829,7 @@ prog_serialize (struct json_value *ret, struct prog *prog)
FORMAT_IDX (ret, "mode", pies_comp_mode_str, prog->v.p.comp->mode);
FORMAT_IDX (ret, "status", pies_status_str, prog->v.p.status);
- json_object_set_bool (ret, "disabled",
- prog->v.p.comp->flags & CF_DISABLED);
+ json_object_set_bool (ret, "active", prog->v.p.active);
if (prog->pid)
json_object_set_number (ret, "PID", prog->pid);
@@ -1873,8 +1872,7 @@ fun_list (struct json_value *result, struct prog *prog)
static int
fun_stop (struct json_value *result, struct prog *prog)
{
- if (prog->v.p.comp->flags & CF_DISABLED
- && prog->v.p.status == status_stopped)
+ if (prog->v.p.active && prog->v.p.status == status_stopped)
{
json_object_set_string (result, "status", "ER");
@@ -1883,7 +1881,7 @@ fun_stop (struct json_value *result, struct prog *prog)
}
else
{
- prog->v.p.comp->flags |= CF_DISABLED;
+ prog->v.p.active = 0;
progman_stop_component (&prog);
json_object_set_string (result, "status", "OK");
}
@@ -1897,6 +1895,7 @@ fun_start (struct json_value *result, struct prog *prog)
{
case status_stopped:
prog->v.p.comp->flags &= ~CF_DISABLED;
+ prog->v.p.active = 1;
json_object_set_string (result, "status", "OK");
break;

Return to:

Send suggestions and report system problems to the System administrator.