]> git.ipfire.org Git - thirdparty/systemd.git/blame - execute.h
add simple event loop
[thirdparty/systemd.git] / execute.h
CommitLineData
5cb5a6ff
LP
1/*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3#ifndef fooexecutehfoo
4#define fooexecutehfoo
5
6typedef struct ExecStatus ExecStatus;
7typedef struct ExecCommand ExecCommand;
8typedef 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
18struct ExecStatus {
19 pid_t pid;
20 time_t timestamp;
9152c765
LP
21 int code; /* as in siginfo_t::si_code */
22 int status; /* as in sigingo_t::si_status */
5cb5a6ff
LP
23};
24
25struct ExecCommand {
26 char *path;
27 char **argv;
28 ExecStatus last_exec_status;
29 LIST_FIELDS(ExecCommand);
30};
31
32struct ExecContext {
33 char **environment;
34 mode_t umask;
35 struct rlimit *rlimit[RLIMIT_NLIMITS];
36 cap_t capabilities;
37 bool capabilities_set:1;
38 bool dumpable:1;
39 int oom_adjust;
40 int nice;
41 char *chdir;
42
43 /* since resolving these names might might involve socket
44 * connections and we don't want to deadlock ourselves these
45 * names are resolved on execution only. */
46 char *user;
47 char *group;
48 char **supplementary_groups;
49};
50
51int exec_spawn(const ExecCommand *command, const ExecContext *context, pid_t *ret);
52
53void exec_context_free(ExecContext *c);
54void exec_command_free_list(ExecCommand *c);
55
56void exec_context_dump(ExecContext *c, FILE* f, const char *prefix);
57
58void exec_context_defaults(ExecContext *c);
59
60#endif