1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
6 typedef struct ExecStatus ExecStatus;
7 typedef struct ExecCommand ExecCommand;
8 typedef struct ExecContext ExecContext;
11 #include <sys/resource.h>
12 #include <sys/capability.h>
20 /* Abstract namespace! */
21 #define LOGGER_SOCKET "/org/freedesktop.org/systemd1/logger"
23 typedef enum ExecOutput {
29 _EXEC_OUTPUT_INVALID = -1
32 typedef enum ExecInput {
36 _EXEC_INPUT_INVALID = -1
42 int code; /* as in siginfo_t::si_code */
43 int status; /* as in sigingo_t::si_status */
49 ExecStatus exec_status;
50 LIST_FIELDS(ExecCommand, command); /* useful for chaining commands */
56 struct rlimit *rlimit[RLIMIT_NLIMITS];
57 char *working_directory, *root_directory;
62 int cpu_sched_priority;
63 cpu_set_t cpu_affinity;
64 unsigned long timer_slack_ns;
66 bool oom_adjust_set:1;
70 bool cpu_affinity_set:1;
71 bool timer_slack_ns_set:1;
76 char *syslog_identifier;
78 /* FIXME: all privs related settings need to be enforced */
81 uint64_t capability_bounding_set_drop;
83 /* Since resolving these names might might involve socket
84 * connections and we don't want to deadlock ourselves these
85 * names are resolved on execution only and in the child
89 char **supplementary_groups;
92 typedef enum ExitStatus {
93 /* EXIT_SUCCESS defined by libc */
94 /* EXIT_FAILURE defined by libc */
95 EXIT_INVALIDARGUMENT = 2,
96 EXIT_NOTIMPLEMENTED = 3,
97 EXIT_NOPERMISSION = 4,
98 EXIT_NOTINSTALLED = 5,
99 EXIT_NOTCONFIGURED = 6,
102 /* The LSB suggests that error codes >= 200 are "reserved". We
103 * use them here under the assumption that they hence are
104 * unused by init scripts.
106 * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */
127 int exec_spawn(const ExecCommand *command, const ExecContext *context, int *fds, unsigned n_fds, pid_t *ret);
129 void exec_command_free_list(ExecCommand *c);
130 void exec_command_free_array(ExecCommand **c, unsigned n);
132 char *exec_command_line(ExecCommand *c);
133 void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix);
134 void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix);
136 void exec_context_init(ExecContext *c);
137 void exec_context_done(ExecContext *c);
138 void exec_context_dump(ExecContext *c, FILE* f, const char *prefix);
140 void exec_status_fill(ExecStatus *s, pid_t pid, int code, int status);
142 const char* exec_output_to_string(ExecOutput i);
143 int exec_output_from_string(const char *s);
145 const char* exec_input_to_string(ExecInput i);
146 int exec_input_from_string(const char *s);