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;
73 bool cpu_sched_reset_on_fork
;
78 char *syslog_identifier
;
80 /* FIXME: all privs related settings need to be enforced */
83 uint64_t capability_bounding_set_drop
;
85 /* Since resolving these names might might involve socket
86 * connections and we don't want to deadlock ourselves these
87 * names are resolved on execution only and in the child
91 char **supplementary_groups
;
94 typedef enum ExitStatus
{
95 /* EXIT_SUCCESS defined by libc */
96 /* EXIT_FAILURE defined by libc */
97 EXIT_INVALIDARGUMENT
= 2,
98 EXIT_NOTIMPLEMENTED
= 3,
99 EXIT_NOPERMISSION
= 4,
100 EXIT_NOTINSTALLED
= 5,
101 EXIT_NOTCONFIGURED
= 6,
104 /* The LSB suggests that error codes >= 200 are "reserved". We
105 * use them here under the assumption that they hence are
106 * unused by init scripts.
108 * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */
129 int exec_spawn(const ExecCommand
*command
, const ExecContext
*context
, int *fds
, unsigned n_fds
, pid_t
*ret
);
131 void exec_command_free_list(ExecCommand
*c
);
132 void exec_command_free_array(ExecCommand
**c
, unsigned n
);
134 char *exec_command_line(ExecCommand
*c
);
135 void exec_command_dump(ExecCommand
*c
, FILE *f
, const char *prefix
);
136 void exec_command_dump_list(ExecCommand
*c
, FILE *f
, const char *prefix
);
138 void exec_context_init(ExecContext
*c
);
139 void exec_context_done(ExecContext
*c
);
140 void exec_context_dump(ExecContext
*c
, FILE* f
, const char *prefix
);
142 void exec_status_fill(ExecStatus
*s
, pid_t pid
, int code
, int status
);
144 const char* exec_output_to_string(ExecOutput i
);
145 int exec_output_from_string(const char *s
);
147 const char* exec_input_to_string(ExecInput i
);
148 int exec_input_from_string(const char *s
);