seccomp.h 888 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. struct seccomp {
  7. int mode;
  8. };
  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. extern long prctl_get_seccomp(void);
  16. extern long prctl_set_seccomp(unsigned long);
  17. static inline int seccomp_mode(struct seccomp *s)
  18. {
  19. return s->mode;
  20. }
  21. #else /* CONFIG_SECCOMP */
  22. #include <linux/errno.h>
  23. struct seccomp { };
  24. #define secure_computing(x) do { } while (0)
  25. static inline long prctl_get_seccomp(void)
  26. {
  27. return -EINVAL;
  28. }
  29. static inline long prctl_set_seccomp(unsigned long arg2)
  30. {
  31. return -EINVAL;
  32. }
  33. static inline int seccomp_mode(struct seccomp *s)
  34. {
  35. return 0;
  36. }
  37. #endif /* CONFIG_SECCOMP */
  38. #endif /* _LINUX_SECCOMP_H */