Rename internal run/task/service states => changes condition names

This patch renames the internal states for run/task/services to avoid
any confusion with the introduction of 'ready:scripts'.

 * WAITING -> PAUSED
 * READY   -> WAITING

A service condition that used, e.g., <service/foo/ready> should now
instead use <service/foo/waiting>.

Note: A new condition with the old name <service/foo/ready> will be
      introduced shortly to signify service "readiness", a concept
      used in other PID 1, like systemd and s6.

For details, see issue #299.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-08-23 15:31:24 +02:00
1 parent 9d79673cea
commit 51ade57723
6 files changed
+20 -20

No files matched your search

+6 -6
View File
@@ -1993,14 +1993,14 @@ restart:
switch (svc->state) {
case SVC_HALTED_STATE:
if (enabled)
svc_set_state(svc, SVC_READY_STATE);
svc_set_state(svc, SVC_WAITING_STATE);
break;
case SVC_DONE_STATE:
if (svc_is_changed(svc))
svc_set_state(svc, SVC_HALTED_STATE);
if (svc_is_runtask(svc) && svc_is_manual(svc) && enabled)
svc_set_state(svc, SVC_READY_STATE);
svc_set_state(svc, SVC_WAITING_STATE);
break;
case SVC_STOPPING_STATE:
@@ -2046,7 +2046,7 @@ restart:
svc_set_state(svc, SVC_STARTING_STATE);
break;
case SVC_READY_STATE:
case SVC_WAITING_STATE:
if (!enabled) {
svc_set_state(svc, SVC_HALTED_STATE);
} else if (cond_get_agg(svc->cond) == COND_ON) {
@@ -2125,7 +2125,7 @@ restart:
case COND_FLUX:
kill(svc->pid, SIGSTOP);
svc_set_state(svc, SVC_WAITING_STATE);
svc_set_state(svc, SVC_PAUSED_STATE);
break;
case COND_ON:
@@ -2148,7 +2148,7 @@ restart:
}
break;
case SVC_WAITING_STATE:
case SVC_PAUSED_STATE:
if (!enabled) {
kill(svc->pid, SIGCONT);
service_stop(svc);
@@ -2157,7 +2157,7 @@ restart:
if (!svc->pid) {
(*restart_cnt)++;
svc_set_state(svc, SVC_READY_STATE);
svc_set_state(svc, SVC_WAITING_STATE);
break;
}
+6 -6
View File
@@ -61,8 +61,8 @@ typedef enum {
SVC_STOPPING_STATE, /* Waiting to collect the child process */
SVC_CLEANUP_STATE, /* Running post: script */
SVC_SETUP_STATE, /* Running pre: script */
SVC_WAITING_STATE, /* Condition is in flux, process SIGSTOPed */
SVC_READY_STATE, /* Enabled but condition not satisfied */
SVC_PAUSED_STATE, /* Condition is in flux, process SIGSTOPed */
SVC_WAITING_STATE, /* Enabled but condition not satisfied */
SVC_STARTING_STATE, /* Conditions OK and pre: script done, start */
SVC_RUNNING_STATE, /* Process running */
} svc_state_t;
@@ -353,8 +353,8 @@ static inline char *svc_status(svc_t *svc)
return "stopping";
}
case SVC_WAITING_STATE:
return "waiting";
case SVC_PAUSED_STATE:
return "paused";
case SVC_CLEANUP_STATE:
return "cleanup";
@@ -362,8 +362,8 @@ static inline char *svc_status(svc_t *svc)
case SVC_SETUP_STATE:
return "setup";
case SVC_READY_STATE:
return "ready";
case SVC_WAITING_STATE:
return "waiting";
case SVC_RUNNING_STATE:
return "running";