personality.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _LINUX_PERSONALITY_H
  2. #define _LINUX_PERSONALITY_H
  3. #include <uapi/linux/personality.h>
  4. /*
  5. * Handling of different ABIs (personalities).
  6. */
  7. struct exec_domain;
  8. struct pt_regs;
  9. extern int register_exec_domain(struct exec_domain *);
  10. extern int unregister_exec_domain(struct exec_domain *);
  11. extern int __set_personality(unsigned int);
  12. /*
  13. * Description of an execution domain.
  14. *
  15. * The first two members are refernced from assembly source
  16. * and should stay where they are unless explicitly needed.
  17. */
  18. typedef void (*handler_t)(int, struct pt_regs *);
  19. struct exec_domain {
  20. const char *name; /* name of the execdomain */
  21. handler_t handler; /* handler for syscalls */
  22. unsigned char pers_low; /* lowest personality */
  23. unsigned char pers_high; /* highest personality */
  24. unsigned long *signal_map; /* signal mapping */
  25. unsigned long *signal_invmap; /* reverse signal mapping */
  26. struct map_segment *err_map; /* error mapping */
  27. struct map_segment *socktype_map; /* socket type mapping */
  28. struct map_segment *sockopt_map; /* socket option mapping */
  29. struct map_segment *af_map; /* address family mapping */
  30. struct module *module; /* module context of the ed. */
  31. struct exec_domain *next; /* linked list (internal) */
  32. };
  33. /*
  34. * Return the base personality without flags.
  35. */
  36. #define personality(pers) (pers & PER_MASK)
  37. /*
  38. * Change personality of the currently running process.
  39. */
  40. #define set_personality(pers) \
  41. ((current->personality == (pers)) ? 0 : __set_personality(pers))
  42. #endif /* _LINUX_PERSONALITY_H */