seccomp.h 900 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #if (__GNUC__ > 2)
  21. typedef struct { } seccomp_t;
  22. #else
  23. typedef struct { int gcc_is_buggy; } seccomp_t;
  24. #endif
  25. #define secure_computing(x) do { } while (0)
  26. /* static inline to preserve typechecking */
  27. static inline int has_secure_computing(struct thread_info *ti)
  28. {
  29. return 0;
  30. }
  31. #endif /* CONFIG_SECCOMP */
  32. #endif /* _LINUX_SECCOMP_H */