Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_SECCOMP_H |
| 2 | #define _LINUX_SECCOMP_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
| 5 | #ifdef CONFIG_SECCOMP |
| 6 | |
| 7 | #define NR_SECCOMP_MODES 1 |
| 8 | |
| 9 | #include <linux/thread_info.h> |
| 10 | #include <asm/seccomp.h> |
| 11 | |
| 12 | typedef struct { int mode; } seccomp_t; |
| 13 | |
| 14 | extern void __secure_computing(int); |
| 15 | static inline void secure_computing(int this_syscall) |
| 16 | { |
| 17 | if (unlikely(test_thread_flag(TIF_SECCOMP))) |
| 18 | __secure_computing(this_syscall); |
| 19 | } |
| 20 | |
Andrea Arcangeli | ffaa8bd | 2005-06-27 14:36:36 -0700 | [diff] [blame] | 21 | static inline int has_secure_computing(struct thread_info *ti) |
| 22 | { |
| 23 | return unlikely(test_ti_thread_flag(ti, TIF_SECCOMP)); |
| 24 | } |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #else /* CONFIG_SECCOMP */ |
| 27 | |
Andrew Morton | a136564 | 2006-01-08 01:04:09 -0800 | [diff] [blame] | 28 | typedef struct { } seccomp_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
| 30 | #define secure_computing(x) do { } while (0) |
Andrea Arcangeli | ffaa8bd | 2005-06-27 14:36:36 -0700 | [diff] [blame] | 31 | /* static inline to preserve typechecking */ |
| 32 | static inline int has_secure_computing(struct thread_info *ti) |
| 33 | { |
| 34 | return 0; |
| 35 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | #endif /* CONFIG_SECCOMP */ |
| 38 | |
| 39 | #endif /* _LINUX_SECCOMP_H */ |