seccomp.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * include/asm-generic/seccomp.h
  4. *
  5. * Copyright (C) 2014 Linaro Limited
  6. * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
  7. */
  8. #ifndef _ASM_GENERIC_SECCOMP_H
  9. #define _ASM_GENERIC_SECCOMP_H
  10. #include <linux/unistd.h>
  11. #if defined(CONFIG_COMPAT) && !defined(__NR_seccomp_read_32)
  12. #define __NR_seccomp_read_32 __NR_read
  13. #define __NR_seccomp_write_32 __NR_write
  14. #define __NR_seccomp_exit_32 __NR_exit
  15. #ifndef __NR_seccomp_sigreturn_32
  16. #define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn
  17. #endif
  18. #endif /* CONFIG_COMPAT && ! already defined */
  19. #define __NR_seccomp_read __NR_read
  20. #define __NR_seccomp_write __NR_write
  21. #define __NR_seccomp_exit __NR_exit
  22. #ifndef __NR_seccomp_sigreturn
  23. #define __NR_seccomp_sigreturn __NR_rt_sigreturn
  24. #endif
  25. #ifdef CONFIG_COMPAT
  26. #ifndef get_compat_mode1_syscalls
  27. static inline const int *get_compat_mode1_syscalls(void)
  28. {
  29. static const int mode1_syscalls_32[] = {
  30. __NR_seccomp_read_32, __NR_seccomp_write_32,
  31. __NR_seccomp_exit_32, __NR_seccomp_sigreturn_32,
  32. -1, /* negative terminated */
  33. };
  34. return mode1_syscalls_32;
  35. }
  36. #endif
  37. #endif /* CONFIG_COMPAT */
  38. #endif /* _ASM_GENERIC_SECCOMP_H */