server: track workers in render_worker_jail

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Chia-I Wu 3 years ago
parent bcd4a601b6
commit 0fc9933dcf
  1. 8
      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);

Loading…
Cancel
Save