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>
22 int code; /* as in siginfo_t::si_code */
23 int status; /* as in sigingo_t::si_status */
29 ExecStatus exec_status;
30 LIST_FIELDS(ExecCommand, command); /* useful for chaining commands */
36 struct rlimit *rlimit[RLIMIT_NLIMITS];
42 bool capabilities_set:1;
44 /* since resolving these names might might involve socket
45 * connections and we don't want to deadlock ourselves these
46 * names are resolved on execution only. */
49 char **supplementary_groups;
52 typedef enum ExitStatus {
53 /* EXIT_SUCCESS defined by libc */
54 /* EXIT_FAILURE defined by libc */
55 EXIT_INVALIDARGUMENT = 2,
56 EXIT_NOTIMPLEMENTED = 3,
57 EXIT_NOPERMISSION = 4,
58 EXIT_NOTINSTALLED = 5,
59 EXIT_NOTCONFIGURED = 6,
62 /* The LSB suggests that error codes >= 200 are "reserved". We
63 * use them here under the assumption that they hence are
64 * unused by init scripts.
66 * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */
78 int exec_spawn(const ExecCommand *command, const ExecContext *context, int *fds, unsigned n_fds, pid_t *ret);
80 void exec_command_free_list(ExecCommand *c);
81 void exec_command_free_array(ExecCommand **c, unsigned n);
83 char *exec_command_line(ExecCommand *c);
84 void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix);
85 void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix);
87 void exec_context_init(ExecContext *c);
88 void exec_context_done(ExecContext *c);
89 void exec_context_dump(ExecContext *c, FILE* f, const char *prefix);
91 void exec_status_fill(ExecStatus *s, pid_t pid, int code, int status);