From 0fc9933dcfa7d587133e9bd8a86f3a3a3bc94b98 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 21 Dec 2021 13:23:52 -0800 Subject: server: track workers in render_worker_jail Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang Reviewed-by: Ryan Neph --- server/render_worker.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/render_worker.c b/server/render_worker.c index c59d8da..165cf98 100644 --- a/server/render_worker.c +++ b/server/render_worker.c @@ -35,6 +35,7 @@ struct render_worker_jail { struct minijail *minijail; + struct list_head workers; int worker_count; }; @@ -46,6 +47,8 @@ struct render_worker { #endif bool reaped; + struct list_head head; + char thread_data[]; }; @@ -154,8 +157,9 @@ fork_minijail(const struct minijail *template) static void render_worker_jail_add_worker(struct render_worker_jail *jail, - UNUSED struct render_worker *worker) + struct render_worker *worker) { + list_add(&worker->head, &jail->workers); jail->worker_count++; } @@ -163,6 +167,7 @@ static void render_worker_jail_remove_worker(struct render_worker_jail *jail, struct render_worker *worker) { + list_del(&worker->head); jail->worker_count--; free(worker); @@ -178,6 +183,7 @@ render_worker_jail_create(int max_worker_count, return NULL; jail->max_worker_count = max_worker_count; + list_inithead(&jail->workers); #if defined(ENABLE_RENDER_SERVER_WORKER_MINIJAIL) jail->minijail = create_minijail(seccomp_filter, seccomp_path); -- cgit v1.2.3