seccomp.h 816 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef _LINUX_SECCOMP_H
  2. #define _LINUX_SECCOMP_H
  3. #include <linux/config.h>
  4. #ifdef CONFIG_SECCOMP
  5. #define NR_SECCOMP_MODES 1
  6. #include <linux/thread_info.h>
  7. #include <asm/seccomp.h>
  8. typedef struct { int mode; } seccomp_t;
  9. extern void __secure_computing(int);
  10. static inline void secure_computing(int this_syscall)
  11. {
  12. if (unlikely(test_thread_flag(TIF_SECCOMP)))
  13. __secure_computing(this_syscall);
  14. }
  15. static inline int has_secure_computing(struct thread_info *ti)
  16. {
  17. return unlikely(test_ti_thread_flag(ti, TIF_SECCOMP));
  18. }
  19. #else /* CONFIG_SECCOMP */
  20. typedef struct { } seccomp_t;
  21. #define secure_computing(x) do { } while (0)
  22. /* static inline to preserve typechecking */
  23. static inline int has_secure_computing(struct thread_info *ti)
  24. {
  25. return 0;
  26. }
  27. #endif /* CONFIG_SECCOMP */
  28. #endif /* _LINUX_SECCOMP_H */