MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / personality.h
blobdb31c5828e4a19fe43175abb825c98e3bb77753a
1 #ifndef _LINUX_PERSONALITY_H
2 #define _LINUX_PERSONALITY_H
4 /*
5 * Handling of different ABIs (personalities).
6 */
8 struct exec_domain;
9 struct pt_regs;
11 extern int register_exec_domain(struct exec_domain *);
12 extern int unregister_exec_domain(struct exec_domain *);
13 extern int __set_personality(unsigned long);
16 * Flags for bug emulation.
18 * These occupy the top three bytes.
20 enum {
21 MMAP_PAGE_ZERO = 0x0100000,
22 ADDR_COMPAT_LAYOUT = 0x0200000,
23 READ_IMPLIES_EXEC = 0x0400000,
24 ADDR_LIMIT_32BIT = 0x0800000,
25 SHORT_INODE = 0x1000000,
26 WHOLE_SECONDS = 0x2000000,
27 STICKY_TIMEOUTS = 0x4000000,
28 ADDR_LIMIT_3GB = 0x8000000,
32 * Security-relevant compatibility flags that must be
33 * cleared upon setuid or setgid exec:
35 #define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC)
38 * Personality types.
40 * These go in the low byte. Avoid using the top bit, it will
41 * conflict with error returns.
43 enum {
44 PER_LINUX = 0x0000,
45 PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
46 PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
47 PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
48 PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS |
49 WHOLE_SECONDS | SHORT_INODE,
50 PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
51 PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
52 PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS,
53 PER_BSD = 0x0006,
54 PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
55 PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
56 PER_LINUX32 = 0x0008,
57 PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
58 PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */
59 PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */
60 PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */
61 PER_RISCOS = 0x000c,
62 PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
63 PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
64 PER_OSF4 = 0x000f, /* OSF/1 v4 */
65 PER_HPUX = 0x0010,
66 PER_MASK = 0x00ff,
71 * Description of an execution domain.
73 * The first two members are refernced from assembly source
74 * and should stay where they are unless explicitly needed.
76 typedef void (*handler_t)(int, struct pt_regs *);
78 struct exec_domain {
79 const char *name; /* name of the execdomain */
80 handler_t handler; /* handler for syscalls */
81 unsigned char pers_low; /* lowest personality */
82 unsigned char pers_high; /* highest personality */
83 unsigned long *signal_map; /* signal mapping */
84 unsigned long *signal_invmap; /* reverse signal mapping */
85 struct map_segment *err_map; /* error mapping */
86 struct map_segment *socktype_map; /* socket type mapping */
87 struct map_segment *sockopt_map; /* socket option mapping */
88 struct map_segment *af_map; /* address family mapping */
89 struct module *module; /* module context of the ed. */
90 struct exec_domain *next; /* linked list (internal) */
94 * Return the base personality without flags.
96 #define personality(pers) (pers & PER_MASK)
99 * Personality of the currently running process.
101 #define get_personality (current->personality)
104 * Change personality of the currently running process.
106 #define set_personality(pers) \
107 ((current->personality == pers) ? 0 : __set_personality(pers))
109 #endif /* _LINUX_PERSONALITY_H */