| /* SPDX-License-Identifier: GPL-2.0-only */ | |
| // Copyright (c) 2026 Jarkko Sakkinen | |
| #ifndef UCELLS_SPAWN_H | |
| #define UCELLS_SPAWN_H | |
| #include <signal.h> | |
| #include <stddef.h> | |
| #include <stdint.h> | |
| #include "base.h" | |
| struct cell_sandbox; | |
| struct cred_spec; | |
| struct staged_fd { | |
| int target; | |
| int source_fd; | |
| }; | |
| struct spawn_plan { | |
| const char *exec_path; | |
| char *const *argv; | |
| char *const *envp; | |
| const struct cred_spec *cred; | |
| bool allow_setgroups; | |
| bool is_init; | |
| const char *hostname; | |
| const struct staged_fd *staged_fds; | |
| size_t nr_staged_fds; | |
| int cgroup_fd; | |
| const struct cell_sandbox *sandbox; | |
| }; | |
| struct child_bootstrap { | |
| const struct spawn_plan *plan; | |
| int *sorted_kept; | |
| int *temp_slots; | |
| int safe_fd_base; | |
| int landlock_fd; | |
| }; | |
| int child_bootstrap_init(struct child_bootstrap *boot, | |
| const struct spawn_plan *plan); | |
| void child_bootstrap_destroy(struct child_bootstrap *boot); | |
| [[noreturn]] void child_bootstrap_run(const struct child_bootstrap *boot, | |
| int initial_err_fd); | |
| int await_child_exec(int err_read, int pidfd); | |
| int spawn_wait_status(const siginfo_t *info); | |
| #endif |