diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-08-21 18:39:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-08-21 18:50:29 +0200 |
commit | 65a57927ad803dc7eddc4ab68221c571638d6e2b (patch) | |
tree | 7d15c92903933c1bfa16f5650a15874663f4520b /src/shared/seccomp-util.h | |
parent | sd-mount: allow creating tmpfs (diff) | |
download | systemd-65a57927ad803dc7eddc4ab68221c571638d6e2b.tar.xz systemd-65a57927ad803dc7eddc4ab68221c571638d6e2b.zip |
seccomp: move seccomp_parse_errno_or_action() into common definitions
Let's remove some HAVE_SECCOMP ifdeffery by simply defining the funcion
in question (seccomp_parse_errno_or_action() + related calls) into
common code that is also compiled if HAVE_SECCOMP is off.
This is generally the better approach anyway, since we want as much as
possible and easily feasible parsers work even if the code implementing
them is disabled. THis is easy to achieve here, hence do.
Diffstat (limited to 'src/shared/seccomp-util.h')
-rw-r--r-- | src/shared/seccomp-util.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/shared/seccomp-util.h b/src/shared/seccomp-util.h index 9c6016449e..7583357e8a 100644 --- a/src/shared/seccomp-util.h +++ b/src/shared/seccomp-util.h @@ -2,8 +2,8 @@ #pragma once #if HAVE_SECCOMP - #include <seccomp.h> +#endif #include <stdbool.h> #include <stdint.h> @@ -13,6 +13,8 @@ #include "set.h" #include "string-util.h" +#if HAVE_SECCOMP + const char* seccomp_arch_to_string(uint32_t c); int seccomp_arch_from_string(const char *n, uint32_t *ret); @@ -143,6 +145,18 @@ int parse_syscall_archs(char **l, Set **ret_archs); uint32_t scmp_act_kill_process(void); +int parse_syscall_and_errno(const char *in, char **name, int *error); + +int seccomp_suppress_sync(void); + +#else + +static inline bool is_seccomp_available(void) { + return false; +} + +#endif + /* This is a special value to be used where syscall filters otherwise expect errno numbers, will be replaced with real seccomp action. */ enum { @@ -164,15 +178,3 @@ static inline const char *seccomp_errno_or_action_to_string(int num) { return "kill"; return errno_to_name(num); } - -int parse_syscall_and_errno(const char *in, char **name, int *error); - -int seccomp_suppress_sync(void); - -#else - -static inline bool is_seccomp_available(void) { - return false; -} - -#endif |