]>
Commit | Line | Data |
---|---|---|
5cb5a6ff LP |
1 | /*-*- Mode: C; c-basic-offset: 8 -*-*/ |
2 | ||
3 | #ifndef fooexecutehfoo | |
4 | #define fooexecutehfoo | |
5 | ||
6 | typedef struct ExecStatus ExecStatus; | |
7 | typedef struct ExecCommand ExecCommand; | |
8 | typedef struct ExecContext ExecContext; | |
9 | ||
10 | #include <sys/time.h> | |
11 | #include <sys/resource.h> | |
12 | #include <sys/capability.h> | |
13 | #include <stdbool.h> | |
14 | #include <stdio.h> | |
15 | ||
16 | #include "list.h" | |
17 | ||
18 | struct ExecStatus { | |
19 | pid_t pid; | |
20 | time_t timestamp; | |
21 | int status; /* as in wait() */ | |
22 | }; | |
23 | ||
24 | struct ExecCommand { | |
25 | char *path; | |
26 | char **argv; | |
27 | ExecStatus last_exec_status; | |
28 | LIST_FIELDS(ExecCommand); | |
29 | }; | |
30 | ||
31 | struct ExecContext { | |
32 | char **environment; | |
33 | mode_t umask; | |
34 | struct rlimit *rlimit[RLIMIT_NLIMITS]; | |
35 | cap_t capabilities; | |
36 | bool capabilities_set:1; | |
37 | bool dumpable:1; | |
38 | int oom_adjust; | |
39 | int nice; | |
40 | char *chdir; | |
41 | ||
42 | /* since resolving these names might might involve socket | |
43 | * connections and we don't want to deadlock ourselves these | |
44 | * names are resolved on execution only. */ | |
45 | char *user; | |
46 | char *group; | |
47 | char **supplementary_groups; | |
48 | }; | |
49 | ||
50 | int exec_spawn(const ExecCommand *command, const ExecContext *context, pid_t *ret); | |
51 | ||
52 | void exec_context_free(ExecContext *c); | |
53 | void exec_command_free_list(ExecCommand *c); | |
54 | ||
55 | void exec_context_dump(ExecContext *c, FILE* f, const char *prefix); | |
56 | ||
57 | void exec_context_defaults(ExecContext *c); | |
58 | ||
59 | #endif |