sandbox.h 910 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (c) 2001 Matej Pfajfar.
  2. * Copyright (c) 2001-2004, Roger Dingledine.
  3. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  4. * Copyright (c) 2007-2013, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file sandbox.h
  8. * \brief Header file for sandbox.c.
  9. **/
  10. #ifndef SANDBOX_H_
  11. #define SANDBOX_H_
  12. #ifndef SYS_SECCOMP
  13. /**
  14. * Used by SIGSYS signal handler to check if the signal was issued due to a
  15. * seccomp2 filter violation.
  16. */
  17. #define SYS_SECCOMP 1
  18. #endif
  19. /**
  20. * Linux definitions
  21. */
  22. #ifdef __linux__
  23. #define __USE_GNU
  24. #include <sys/ucontext.h>
  25. /**
  26. * Linux 32 bit definitions
  27. */
  28. #if defined(__i386__)
  29. #define REG_SYSCALL REG_EAX
  30. /**
  31. * Linux 64 bit definitions
  32. */
  33. #elif defined(__x86_64__)
  34. #define REG_SYSCALL REG_RAX
  35. #endif
  36. #endif // __linux__
  37. void sandbox_set_debugging_fd(int fd);
  38. int tor_global_sandbox(void);
  39. #endif /* SANDBOX_H_ */