seccomp.h 990 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef _LINUX_SECCOMP_H
  2. #define _LINUX_SECCOMP_H
  3. #ifdef CONFIG_SECCOMP
  4. #include <linux/thread_info.h>
  5. #include <asm/seccomp.h>
  6. typedef struct { int mode; } seccomp_t;
  7. extern void __secure_computing(int);
  8. static inline void secure_computing(int this_syscall)
  9. {
  10. if (unlikely(test_thread_flag(TIF_SECCOMP)))
  11. __secure_computing(this_syscall);
  12. }
  13. static inline int has_secure_computing(struct thread_info *ti)
  14. {
  15. return unlikely(test_ti_thread_flag(ti, TIF_SECCOMP));
  16. }
  17. extern long prctl_get_seccomp(void);
  18. extern long prctl_set_seccomp(unsigned long);
  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. static inline long prctl_get_seccomp(void)
  28. {
  29. return -EINVAL;
  30. }
  31. static inline long prctl_set_seccomp(unsigned long arg2)
  32. {
  33. return -EINVAL;
  34. }
  35. #endif /* CONFIG_SECCOMP */
  36. #endif /* _LINUX_SECCOMP_H */