exec_domain.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Handling of different ABIs (personalities).
  3. *
  4. * We group personalities into execution domains which have their
  5. * own handlers for kernel entry points, signal mapping, etc...
  6. *
  7. * 2001-05-06 Complete rewrite, Christoph Hellwig (hch@infradead.org)
  8. */
  9. #include <linux/init.h>
  10. #include <linux/kernel.h>
  11. #include <linux/kmod.h>
  12. #include <linux/module.h>
  13. #include <linux/personality.h>
  14. #include <linux/proc_fs.h>
  15. #include <linux/sched.h>
  16. #include <linux/seq_file.h>
  17. #include <linux/syscalls.h>
  18. #include <linux/sysctl.h>
  19. #include <linux/types.h>
  20. #include <linux/fs_struct.h>
  21. #ifdef CONFIG_PROC_FS
  22. static int execdomains_proc_show(struct seq_file *m, void *v)
  23. {
  24. seq_puts(m, "0-0\tLinux \t[kernel]\n");
  25. return 0;
  26. }
  27. static int execdomains_proc_open(struct inode *inode, struct file *file)
  28. {
  29. return single_open(file, execdomains_proc_show, NULL);
  30. }
  31. static const struct file_operations execdomains_proc_fops = {
  32. .open = execdomains_proc_open,
  33. .read = seq_read,
  34. .llseek = seq_lseek,
  35. .release = single_release,
  36. };
  37. static int __init proc_execdomains_init(void)
  38. {
  39. proc_create("execdomains", 0, NULL, &execdomains_proc_fops);
  40. return 0;
  41. }
  42. module_init(proc_execdomains_init);
  43. #endif
  44. SYSCALL_DEFINE1(personality, unsigned int, personality)
  45. {
  46. unsigned int old = current->personality;
  47. if (personality != 0xffffffff)
  48. set_personality(personality);
  49. return old;
  50. }