summaryrefslogtreecommitdiffstats
path: root/job.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-10 18:42:14 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-10 18:42:14 +0000
commit095ecf2d9002a10e034268a0a709c5b5bb5c2ae5 (patch)
tree284e424b1b340602f19d6ea5274a17952673ee9e /job.c
parentb7c364a853352531dbc48758046ae7056a8885fa (diff)
Put all jobs on a global all_jobs list and use that in server.c instead of
running through all the clients.
Diffstat (limited to 'job.c')
-rw-r--r--job.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/job.c b/job.c
index 91646eda..53b05bb4 100644
--- a/job.c
+++ b/job.c
@@ -30,6 +30,9 @@
* output.
*/
+/* All jobs list. */
+struct joblist all_jobs = SLIST_HEAD_INITIALIZER(&all_jobs);
+
RB_GENERATE(jobs, job, entry, job_cmp);
int
@@ -67,6 +70,7 @@ job_tree_free(struct jobs *jobs)
while (!RB_EMPTY(jobs)) {
job = RB_ROOT(jobs);
RB_REMOVE(jobs, jobs, job);
+ SLIST_REMOVE(&all_jobs, job, job, lentry);
job_free(job);
}
}
@@ -90,6 +94,7 @@ job_add(struct jobs *jobs, struct client *c, const char *cmd,
job = xmalloc(sizeof *job);
job->cmd = xstrdup(cmd);
+ job->pid = -1;
job->client = c;
@@ -101,6 +106,7 @@ job_add(struct jobs *jobs, struct client *c, const char *cmd,
job->data = data;
RB_INSERT(jobs, jobs, job);
+ SLIST_INSERT_HEAD(&all_jobs, job, lentry);
return (job);
}