nbos

nbos

https://git.tonybtw.com/nbos.git git://git.tonybtw.com/nbos.git
1,285 bytes raw
1
#define _GNU_SOURCE
2
#include "sandbox.h"
3
4
#include <errno.h>
5
#include <fcntl.h>
6
#include <sched.h>
7
#include <stdio.h>
8
#include <string.h>
9
#include <sys/mount.h>
10
#include <sys/stat.h>
11
#include <sys/types.h>
12
#include <unistd.h>
13
14
/**
15
 * sandbox_setup() - Build a hermetic sandbox at @sandbox_root.
16
 * @sandbox_root: Directory the sandbox is constructed under.
17
 * @deps: Direct build deps of the package being built.
18
 * @resolved_deps: Resolved entries paralleling the system's pkg list.
19
 * @src_dir: Source tree to bind-mount as the build root inside.
20
 *
21
 * Read-only bind mounts each dep's store path; provides /dev/null,
22
 * /dev/urandom, fresh procfs, a private tmpfs, and the source tree
23
 * at /build. No network, no host /home, /etc, or /root.
24
 *
25
 * Return: 0 on success, errno value on failure.
26
 */
27
int sandbox_setup(
28
    const char     *sandbox_root,
29
    const pkg_refs *deps,
30
    const resolved *resolved_deps,
31
    const char     *src_dir
32
) {
33
    (void)sandbox_root;
34
    (void)deps;
35
    (void)resolved_deps;
36
    (void)src_dir;
37
    return ENOSYS;
38
}
39
40
/**
41
 * sandbox_teardown() - Undo a sandbox built by sandbox_setup().
42
 * @sandbox_root: Directory previously passed to sandbox_setup().
43
 */
44
void sandbox_teardown(const char *sandbox_root) {
45
    if (sandbox_root == nullptr) return;
46
}