summaryrefslogtreecommitdiffstats
path: root/usr.sbin/jail/state.c
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2010-12-10 23:57:55 +0000
committerjamie <jamie@FreeBSD.org>2010-12-10 23:57:55 +0000
commit3a156b82bb5985e9c61a72da436b8f7ccc2c9b24 (patch)
tree25592d900e664bd0c09efdb491597e0b6f5b70f6 /usr.sbin/jail/state.c
parent2e7c3af0f17fe5e2c5e6677314eede9143914c5f (diff)
downloadFreeBSD-src-3a156b82bb5985e9c61a72da436b8f7ccc2c9b24.zip
FreeBSD-src-3a156b82bb5985e9c61a72da436b8f7ccc2c9b24.tar.gz
run_command (mostly) cleanup:
Make the parallelism limit a global instead of always passing it to run_command and finish_command. In the case of an empty command string, try to run any other strings the command may have. Replace JF_BACKGROUND with its sort-of opposite JF_SLEEPQ. Change j->comstring earlier to render JF_RUNQ unncessary. Change the if-else series to a more readable switch statement. Treat IP_STOP_TIMEOUT like a command, calling run_command which then calls term_procs. When the IP_STOP_TIMEOUT "command" finishes, it shouldn't mess with the parallelism limit. Make sufficient checks in finish_command and run_command so that the nonintuitive j->comstring null check isn't necessary to run them. Rename the "waiting" queue to "depend", because the "sleeping" and "runnable" queues are also used to wait for something.
Diffstat (limited to 'usr.sbin/jail/state.c')
-rw-r--r--usr.sbin/jail/state.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/jail/state.c b/usr.sbin/jail/state.c
index 159afbc..a2b8db2 100644
--- a/usr.sbin/jail/state.c
+++ b/usr.sbin/jail/state.c
@@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
#include "jailp.h"
struct cfjails ready = TAILQ_HEAD_INITIALIZER(ready);
-struct cfjails waiting = TAILQ_HEAD_INITIALIZER(waiting);
+struct cfjails depend = TAILQ_HEAD_INITIALIZER(depend);
static void dep_add(struct cfjail *from, struct cfjail *to, unsigned flags);
static int cmp_jailptr(const void *a, const void *b);
@@ -133,7 +133,7 @@ dep_setup(int docf)
requeue(j, &cfjails);
dep_done(j, DF_NOFAIL);
}
- while ((j = TAILQ_FIRST(&waiting)) != NULL) {
+ while ((j = TAILQ_FIRST(&depend)) != NULL) {
jail_warnx(j, "dependency loop");
j->flags |= JF_FAILED;
do {
@@ -222,7 +222,7 @@ dep_check(struct cfjail *j)
}
if (ndeps == 0)
return 0;
- requeue(j, &waiting);
+ requeue(j, &depend);
return 1;
}
@@ -256,7 +256,7 @@ dep_done(struct cfjail *j, unsigned flags)
jail_warnx(dj, "skipped");
dj->flags |= JF_FAILED;
}
- if (!--dj->ndeps && dj->queue == &waiting)
+ if (!--dj->ndeps && dj->queue == &depend)
requeue(dj, &ready);
}
}
@@ -315,7 +315,7 @@ start_state(const char *target, unsigned state, int running)
TAILQ_FOREACH_SAFE(j, &cfjails, tq, tj) {
j->flags = (j->flags & JF_FAILED) | state | JF_WILD;
dep_reset(j);
- requeue(j, j->ndeps ? &waiting : &ready);
+ requeue(j, j->ndeps ? &depend : &ready);
}
} else if (wild_jail_name(target)) {
/*
OpenPOWER on IntegriCloud