shared: Clean up includes

Split out of #37344.
This commit is contained in:
Daan De Meyer
2025-05-24 14:00:44 +02:00
parent 9d75fb9647
commit 69a283c5f2
394 changed files with 1181 additions and 1903 deletions
+22 -9
View File
@@ -1,35 +1,30 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <linux/seccomp.h>
#include <stddef.h>
#include <sched.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <sys/shm.h>
#include <sys/stat.h>
/* clang-format off */
/* include missing_syscall_def.h earlier to make __SNR_foo mapped to __NR_foo. */
#include "missing_syscall_def.h"
#include <seccomp.h>
/* clang-format on */
#include "af-list.h"
#include "alloc-util.h"
#include "env-util.h"
#include "errno-list.h"
#include "log.h"
#include "macro.h"
#include "namespace-util.h"
#include "nsflags.h"
#include "nulstr-util.h"
#include "parse-util.h"
#include "process-util.h"
#include "seccomp-util.h"
#include "set.h"
#include "string-util.h"
#include "strv.h"
#if HAVE_SECCOMP
/* This array will be modified at runtime as seccomp_restrict_archs is called. */
uint32_t seccomp_local_archs[] = {
@@ -2525,3 +2520,21 @@ int seccomp_suppress_sync(void) {
return 0;
}
#endif
bool seccomp_errno_or_action_is_valid(int n) {
return n == SECCOMP_ERROR_NUMBER_KILL || errno_is_valid(n);
}
int seccomp_parse_errno_or_action(const char *p) {
if (streq_ptr(p, "kill"))
return SECCOMP_ERROR_NUMBER_KILL;
return parse_errno(p);
}
const char* seccomp_errno_or_action_to_string(int num) {
if (num == SECCOMP_ERROR_NUMBER_KILL)
return "kill";
return errno_to_name(num);
}