1 /* 2 * Copyright 2021 Google LLC 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #ifndef RENDER_WORKER_H 7 #define RENDER_WORKER_H 8 9 #include "render_common.h" 10 11 enum render_worker_jail_seccomp_filter { 12 /* seccomp_path is ignored and seccomp is disabled */ 13 RENDER_WORKER_JAIL_SECCOMP_NONE, 14 /* seccomp_path is a file containing a BPF program */ 15 RENDER_WORKER_JAIL_SECCOMP_BPF, 16 /* seccomp_path is a file containing a minijail policy */ 17 RENDER_WORKER_JAIL_SECCOMP_MINIJAIL_POLICY, 18 RENDER_WORKER_JAIL_SECCOMP_MINIJAIL_POLICY_LOG, 19 }; 20 21 struct render_worker_jail * 22 render_worker_jail_create(int max_worker_count, 23 enum render_worker_jail_seccomp_filter seccomp_filter, 24 const char *seccomp_path); 25 26 void 27 render_worker_jail_destroy(struct render_worker_jail *jail); 28 29 int 30 render_worker_jail_get_sigchld_fd(const struct render_worker_jail *jail); 31 32 bool 33 render_worker_jail_reap_workers(struct render_worker_jail *jail); 34 35 void 36 render_worker_jail_detach_workers(struct render_worker_jail *jail); 37 38 struct render_worker * 39 render_worker_create(struct render_worker_jail *jail, 40 int (*thread_func)(void *thread_data), 41 void *thread_data, 42 size_t thread_data_size); 43 44 void 45 render_worker_destroy(struct render_worker_jail *jail, struct render_worker *worker); 46 47 bool 48 render_worker_is_record(const struct render_worker *worker); 49 50 #endif /* RENDER_WORKER_H */ 51