aboutsummaryrefslogtreecommitdiff
path: root/initd/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'initd/config.c')
-rw-r--r--initd/config.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/initd/config.c b/initd/config.c
index d994faa..fa12ab2 100644
--- a/initd/config.c
+++ b/initd/config.c
@@ -15,6 +15,7 @@ static size_t queue_count[TGT_MAX];
/* current state */
static size_t queue_idx = 0;
static int target = TGT_BOOT;
+static svc_run_data_t *waiting = NULL;
int config_load(void)
{
@@ -62,6 +63,24 @@ int config_load(void)
return 0;
}
+void config_set_waiting(svc_run_data_t *rt)
+{
+ assert(waiting == NULL);
+ waiting = rt;
+}
+
+bool config_is_waiting(void)
+{
+ if (waiting != NULL) {
+ if (waiting->state == STATE_RUNNING)
+ return true;
+
+ waiting = NULL;
+ }
+
+ return false;
+}
+
svc_run_data_t *config_rt_data_by_pid(pid_t pid)
{
size_t i;
@@ -79,6 +98,9 @@ svc_run_data_t *config_rt_data_by_pid(pid_t pid)
svc_run_data_t *config_dequeue(void)
{
+ if (config_is_waiting())
+ return NULL;
+
if (queue_idx >= queue_count[target])
return NULL;
@@ -100,6 +122,7 @@ void config_set_target(int tgt)
target = tgt;
queue_idx = 0;
+ waiting = NULL;
}
bool config_should_respawn(void)