aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-02-24 13:29:15 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-02-24 13:32:57 +0200
commit9912557fa9b4c8596c6e9f69857e9a616b4f4f33 (patch)
tree348bcb58c3af3c5138abe6e3bdfda5232fc1e54c
parent4049c8b3ba918949106ef8e96ac5e767f4b9406b (diff)
downloadpies-9912557fa9b4c8596c6e9f69857e9a616b4f4f33.tar.gz
pies-9912557fa9b4c8596c6e9f69857e9a616b4f4f33.tar.bz2
Changes in prog structure
* src/prog.h (prog): Remove .facility. Use facility from the component. (active,wait,stop): Move from union into the main struct. All uses changed.
-rw-r--r--src/comp.c2
-rw-r--r--src/ctl.c12
-rw-r--r--src/inetd-bi.c2
-rw-r--r--src/prog.h10
-rw-r--r--src/progman.c51
-rw-r--r--src/sysvinit.c18
6 files changed, 46 insertions, 49 deletions
diff --git a/src/comp.c b/src/comp.c
index 7babae7..41b77ce 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -371,3 +371,3 @@ mark_prog (struct prog *prog, void *data)
if (prog_is_leftover (prog))
- prog->v.p.stop = 1;
+ prog->stop = 1;
return 0;
diff --git a/src/ctl.c b/src/ctl.c
index 21abf59..a7db410 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -1836,3 +1836,3 @@ prog_active (struct prog *prog)
{
- if (prog->v.p.active)
+ if (prog->active)
{
@@ -1841,6 +1841,6 @@ prog_active (struct prog *prog)
prog = progman_locate (prog->v.p.comp->tcpmux);
- return prog && prog->v.p.active;
+ return prog && prog->active;
}
}
- return prog->v.p.active;
+ return prog->active;
}
@@ -1914,3 +1914,3 @@ fun_stop (struct json_value *result, struct prog *prog)
{
- if (!prog->v.p.active)
+ if (!prog->active)
{
@@ -1921,3 +1921,3 @@ fun_stop (struct json_value *result, struct prog *prog)
- prog->v.p.active = 0;
+ prog->active = 0;
progman_stop_component (&prog);
@@ -1974,3 +1974,3 @@ fun_start (struct json_value *result, struct prog *prog)
}
- prog->v.p.active = 1;
+ prog->active = 1;
return 0;
diff --git a/src/inetd-bi.c b/src/inetd-bi.c
index 2032123..61b6f55 100644
--- a/src/inetd-bi.c
+++ b/src/inetd-bi.c
@@ -307,3 +307,3 @@ tcpmux_help (struct component *comp, void *data)
- if (ISCF_TCPMUX (comp->flags) && comp->prog && comp->prog->v.p.active)
+ if (ISCF_TCPMUX (comp->flags) && comp->prog && comp->prog->active)
{
diff --git a/src/prog.h b/src/prog.h
index 3358885..be072e1 100644
--- a/src/prog.h
+++ b/src/prog.h
@@ -47,3 +47,5 @@ struct prog
pid_t pid; /* PID */
- int facility;
+ int active :1; /* The prog is active */
+ int wait :1; /* Wait for this prog to terminate */
+ int stop :1; /* Stop this prog */
union
@@ -53,5 +55,2 @@ struct prog
struct component *comp;
- int active :1; /* The prog is active */
- int wait :1; /* Wait for this prog to terminate */
- int stop :1; /* Stop this prog */
int socket;
@@ -86,4 +85,3 @@ struct prog
#define IS_COMPONENT(p) ((p)->type == TYPE_COMPONENT)
-#define IS_ACTIVE_COMPONENT(prog) \
- (IS_COMPONENT(prog) && (prog)->v.p.active)
+#define IS_ACTIVE_COMPONENT(prog) (IS_COMPONENT(prog) && (prog)->active)
diff --git a/src/progman.c b/src/progman.c
index 852a71c..9f5c466 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -76,3 +76,3 @@ progman_lookup_tcpmux (const char *service, const char *master)
&& ISCF_TCPMUX (prog->v.p.comp->flags)
- && prog->v.p.active
+ && prog->active
&& prog->v.p.comp->service
@@ -281,3 +281,2 @@ register_prog0 (struct component *comp)
newp->pid = 0;
- newp->facility = comp->facility;
newp->v.p.comp = comp;
@@ -291,5 +290,5 @@ register_prog0 (struct component *comp)
if ((comp->flags & CF_DISABLED) || comp->mode == pies_comp_ondemand)
- newp->v.p.active = 0;
+ newp->active = 0;
else
- newp->v.p.active = 1;
+ newp->active = 1;
@@ -327,3 +326,3 @@ progman_waiting_p (void)
{
- if (IS_COMPONENT (prog) && prog->v.p.wait && prog->pid > 0)
+ if (IS_COMPONENT (prog) && prog->wait && prog->pid > 0)
{
@@ -442,3 +441,3 @@ open_redirector (struct prog *master, int stream)
_exit (1);
- openlog (prog_tag (master), LOG_PID, master->facility);
+ openlog (prog_tag (master), LOG_PID, master->v.p.comp->facility);
prio = master->v.p.comp->redir[stream].v.prio;
@@ -958,3 +957,3 @@ prog_open_socket (struct prog *prog)
prog->v.p.status = status_stopped;
- prog->v.p.active = 0;
+ prog->active = 0;
return 1;
@@ -967,3 +966,3 @@ prog_open_socket (struct prog *prog)
prog->v.p.status = status_stopped;
- prog->v.p.active = 0;
+ prog->active = 0;
return 1;
@@ -1059,3 +1058,3 @@ prog_start (struct prog *prog)
{
- if (prog->v.p.active)
+ if (prog->active)
{
@@ -1064,3 +1063,3 @@ prog_start (struct prog *prog)
prog->v.p.status = status_stopped;
- prog->v.p.active = 0;
+ prog->active = 0;
}
@@ -1525,3 +1524,3 @@ progman_start (void)
case status_listener:
- if (!prog->v.p.active)
+ if (!prog->active)
disable_socket (prog->v.p.socket);
@@ -1561,5 +1560,5 @@ progman_wake_sleeping (int onalrm)
{
- if (IS_ACTIVE_COMPONENT (prog) && prog->v.p.wait)
+ if (IS_ACTIVE_COMPONENT (prog) && prog->wait)
{
- /* The following works on the assumption that prog->v.p.wait is
+ /* The following works on the assumption that prog->wait is
set when enabling the component and gets cleared right after
@@ -1622,3 +1621,3 @@ prog_start_prerequisites (struct prog *prog)
- if (!prog->v.p.active)
+ if (!prog->active)
return 1;
@@ -1638,5 +1637,5 @@ prog_start_prerequisites (struct prog *prog)
- if (!prog->v.p.active)
+ if (!prog->active)
{
- prog->v.p.active = 0;
+ prog->active = 0;
return 1;
@@ -1737,3 +1736,3 @@ mark_for_stopping (struct prog *prog, void *data)
if (IS_COMPONENT (prog))
- prog->v.p.stop = 1;
+ prog->stop = 1;
return 0;
@@ -2225,3 +2224,3 @@ react (struct prog *prog, int status, pid_t pid)
prog_tag (prog));
- prog->v.p.active = 0;
+ prog->active = 0;
/* FIXME:
@@ -2264,3 +2263,3 @@ progman_cleanup (int expect_term)
print_status (prog_tag (prog), pid, status, expect_term);
- prog->v.p.stop = 0;
+ prog->stop = 0;
if (prog->v.p.comp->mode == pies_comp_inetd)
@@ -2304,6 +2303,6 @@ progman_cleanup (int expect_term)
- if (prog->v.p.wait)
+ if (prog->wait)
{
pies_schedule_children (PIES_CHLD_WAKEUP);
- prog->v.p.wait = 0;
+ prog->wait = 0;
}
@@ -2368,3 +2367,3 @@ progman_stop_component (struct prog **progptr)
case status_stopped:
- prog->v.p.stop = 0;
+ prog->stop = 0;
if (!component_is_active (prog->v.p.comp))
@@ -2376,4 +2375,4 @@ progman_stop_component (struct prog **progptr)
destroy_prog (progptr);
- else if (prog->v.p.stop)
- prog->v.p.stop = 0;
+ else if (prog->stop)
+ prog->stop = 0;
else
@@ -2389,3 +2388,3 @@ progman_stop_component (struct prog **progptr)
case status_finished:
- prog->v.p.stop = 0;
+ prog->stop = 0;
if (!component_is_active (prog->v.p.comp))
@@ -2441,3 +2440,3 @@ prog_to_stop (struct prog *prog)
for (; prog; prog = prog->next)
- if (IS_COMPONENT (prog) && prog->v.p.stop)
+ if (IS_COMPONENT (prog) && prog->stop)
break;
diff --git a/src/sysvinit.c b/src/sysvinit.c
index bbd97f3..0b12b4a 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -245,3 +245,3 @@ enablecomp (struct prog *prog, void *data)
/* Active flag persists: */
- return prog->v.p.active;
+ return prog->active;
@@ -284,14 +284,14 @@ runlevel_setup_prog (struct prog *prog, void *data)
int rc = enablecomp (prog, data);
- if (rc < 0 || prog->v.p.active == rc)
+ if (rc < 0 || prog->active == rc)
return 0;
- prog->v.p.active = rc;
+ prog->active = rc;
if (rc)
- prog->v.p.wait = is_comp_wait (prog->v.p.comp);
+ prog->wait = is_comp_wait (prog->v.p.comp);
else if (prog->v.p.status != status_stopped
&& prog->v.p.status != status_finished)
- prog->v.p.stop = 1;
+ prog->stop = 1;
debug (2, ("%s: %s%s", prog_tag (prog),
- prog->v.p.active ?
+ prog->active ?
"enabled" : "disabled",
- prog->v.p.active && prog->v.p.wait ? " (wait)" : ""));
+ prog->active && prog->wait ? " (wait)" : ""));
}
@@ -318,3 +318,3 @@ demand_prog (struct prog *prog, void *data)
{
- prog->v.p.active = 1;
+ prog->active = 1;
debug (1, ("%s: %s", prog_tag (prog), "enabled"));
@@ -766,3 +766,3 @@ sysvinit_begin (void)
&& prog->v.p.status == status_running \
- && !prog->v.p.active)
+ && !prog->active)

Return to:

Send suggestions and report system problems to the System administrator.