Blame view

include/linux/seccomp.h 897 Bytes
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX_SECCOMP_H
  #define _LINUX_SECCOMP_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
4
  
  #ifdef CONFIG_SECCOMP
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
5
6
7
8
9
10
11
12
13
14
15
  #include <linux/thread_info.h>
  #include <asm/seccomp.h>
  
  typedef struct { int mode; } seccomp_t;
  
  extern void __secure_computing(int);
  static inline void secure_computing(int this_syscall)
  {
  	if (unlikely(test_thread_flag(TIF_SECCOMP)))
  		__secure_computing(this_syscall);
  }
1d9d02fee   Andrea Arcangeli   move seccomp from...
16
17
  extern long prctl_get_seccomp(void);
  extern long prctl_set_seccomp(unsigned long);
5cec93c21   Andy Lutomirski   x86-64: Emulate l...
18
19
20
21
  static inline int seccomp_mode(seccomp_t *s)
  {
  	return s->mode;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
  #else /* CONFIG_SECCOMP */
42a17ad27   Ralf Baechle   <linux/seccomp.h>...
23
  #include <linux/errno.h>
a13656470   Andrew Morton   [PATCH] remove gc...
24
  typedef struct { } seccomp_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
26
  
  #define secure_computing(x) do { } while (0)
1d9d02fee   Andrea Arcangeli   move seccomp from...
27
28
29
30
31
32
33
34
35
  static inline long prctl_get_seccomp(void)
  {
  	return -EINVAL;
  }
  
  static inline long prctl_set_seccomp(unsigned long arg2)
  {
  	return -EINVAL;
  }
5cec93c21   Andy Lutomirski   x86-64: Emulate l...
36
37
38
39
  static inline int seccomp_mode(seccomp_t *s)
  {
  	return 0;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
40
41
42
  #endif /* CONFIG_SECCOMP */
  
  #endif /* _LINUX_SECCOMP_H */