]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/exec-util.h
catalog: update Polish translation
[thirdparty/systemd.git] / src / shared / exec-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
f18edd8a 2#pragma once
89711996 3
c6e47247
ZJS
4#include <stdbool.h>
5
89711996
ZJS
6#include "time-util.h"
7
c6e47247
ZJS
8typedef int (*gather_stdout_callback_t) (int fd, void *arg);
9
10enum {
11 STDOUT_GENERATE, /* from generators to helper process */
12 STDOUT_COLLECT, /* from helper process to main process */
13 STDOUT_CONSUME, /* process data in main process */
14 _STDOUT_CONSUME_MAX,
15};
16
4b05f0c9
MK
17typedef enum {
18 EXEC_DIR_NONE = 0, /* No execdir flags */
19 EXEC_DIR_PARALLEL = 1 << 0, /* Execute scripts in parallel, if possible */
20 EXEC_DIR_IGNORE_ERRORS = 1 << 1, /* Ignore non-zero exit status of scripts */
21} ExecDirFlags;
22
b3d59367
AZ
23typedef enum ExecCommandFlags {
24 EXEC_COMMAND_IGNORE_FAILURE = 1 << 0,
25 EXEC_COMMAND_FULLY_PRIVILEGED = 1 << 1,
26 EXEC_COMMAND_NO_SETUID = 1 << 2,
27 EXEC_COMMAND_AMBIENT_MAGIC = 1 << 3,
28 EXEC_COMMAND_NO_ENV_EXPAND = 1 << 4,
29 _EXEC_COMMAND_FLAGS_INVALID = -1,
30} ExecCommandFlags;
31
c6e47247
ZJS
32int execute_directories(
33 const char* const* directories,
34 usec_t timeout,
35 gather_stdout_callback_t const callbacks[_STDOUT_CONSUME_MAX],
36 void* const callback_args[_STDOUT_CONSUME_MAX],
78ec1bb4 37 char *argv[],
4b05f0c9
MK
38 char *envp[],
39 ExecDirFlags flags);
3303d1b2 40
b3d59367
AZ
41int exec_command_flags_from_strv(char **ex_opts, ExecCommandFlags *flags);
42int exec_command_flags_to_strv(ExecCommandFlags flags, char ***ex_opts);
43
3303d1b2 44extern const gather_stdout_callback_t gather_environment[_STDOUT_CONSUME_MAX];
b3d59367
AZ
45
46const char* exec_command_flags_to_string(ExecCommandFlags i);
47ExecCommandFlags exec_command_flags_from_string(const char *s);