4 #include <linux/types.h>
7 #define MAX_S_CONTEXT 65535 /* Arbitrary limit */
8 #define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
10 #define VX_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */
14 #define VXF_INFO_LOCK 0x00000001
15 #define VXF_INFO_SCHED 0x00000002
16 #define VXF_INFO_NPROC 0x00000004
17 #define VXF_INFO_PRIVATE 0x00000008
19 #define VXF_INFO_INIT 0x00000010
20 #define VXF_INFO_HIDE 0x00000020
21 #define VXF_INFO_ULIMIT 0x00000040
22 #define VXF_INFO_NSPACE 0x00000080
24 #define VXF_SCHED_HARD 0x00000100
25 #define VXF_SCHED_PRIO 0x00000200
26 #define VXF_SCHED_PAUSE 0x00000400
27 #define VXF_SCHED_SHARE 0x00000800
29 #define VXF_VIRT_MEM 0x00010000
30 #define VXF_VIRT_UPTIME 0x00020000
31 #define VXF_VIRT_CPU 0x00040000
32 #define VXF_VIRT_LOAD 0x00080000
34 #define VXF_HIDE_MOUNT 0x01000000
35 #define VXF_HIDE_NETIF 0x02000000
37 #define VXF_STATE_SETUP (1ULL<<32)
38 #define VXF_STATE_INIT (1ULL<<33)
40 #define VXF_STATE_HELPER (1ULL<<36)
42 #define VXF_FORK_RSS (1ULL<<48)
43 #define VXF_PROLIFIC (1ULL<<49)
45 #define VXF_IGNEG_NICE (1ULL<<52)
47 #define VXF_ONE_TIME (0x0003ULL<<32)
49 #define VXF_INIT_SET (VXF_STATE_SETUP|VXF_STATE_INIT)
54 #define VXC_CAP_MASK 0x00000000
56 #define VXC_SET_UTSNAME 0x00000001
57 #define VXC_SET_RLIMIT 0x00000002
59 #define VXC_RAW_ICMP 0x00000100
60 #define VXC_SYSLOG 0x00001000
62 #define VXC_SECURE_MOUNT 0x00010000
63 #define VXC_SECURE_REMOUNT 0x00020000
64 #define VXC_BINARY_MOUNT 0x00040000
66 #define VXC_QUOTA_CTL 0x00100000
69 /* context state changes */
82 #include <linux/list.h>
83 #include <linux/spinlock.h>
84 #include <linux/rcupdate.h>
86 #include "limit_def.h"
87 #include "sched_def.h"
88 #include "cvirt_def.h"
91 struct hlist_node vx_hlist; /* linked list of contexts */
92 xid_t vx_id; /* context id */
93 atomic_t vx_usecnt; /* usage count */
94 atomic_t vx_tasks; /* tasks count */
95 struct vx_info *vx_parent; /* parent context */
96 int vx_state; /* context state */
98 struct namespace *vx_namespace; /* private namespace */
99 struct fs_struct *vx_fs; /* private namespace fs */
100 uint64_t vx_flags; /* context flags */
101 uint64_t vx_bcaps; /* bounding caps (system) */
102 uint64_t vx_ccaps; /* context caps (vserver) */
104 pid_t vx_initpid; /* PID of fake init process */
106 wait_queue_head_t vx_wait; /* context exit waitqueue */
108 struct _vx_limit limit; /* vserver limits */
109 struct _vx_sched sched; /* vserver scheduler */
110 struct _vx_cvirt cvirt; /* virtual/bias stuff */
111 struct _vx_cacct cacct; /* context accounting */
113 char vx_name[65]; /* vserver name */
119 #define VXS_HASHED 0x0001
120 #define VXS_PAUSED 0x0010
121 #define VXS_ONHOLD 0x0020
122 #define VXS_SHUTDOWN 0x0100
123 #define VXS_RELEASED 0x8000
125 /* check conditions */
127 #define VX_ADMIN 0x0001
128 #define VX_WATCH 0x0002
129 #define VX_HIDE 0x0004
130 #define VX_HOSTID 0x0008
132 #define VX_IDENT 0x0010
133 #define VX_EQUIV 0x0020
134 #define VX_PARENT 0x0040
135 #define VX_CHILD 0x0080
137 #define VX_ARG_MASK 0x00F0
139 #define VX_DYNAMIC 0x0100
140 #define VX_STATIC 0x0200
142 #define VX_ATR_MASK 0x0F00
145 extern void claim_vx_info(struct vx_info *, struct task_struct *);
146 extern void release_vx_info(struct vx_info *, struct task_struct *);
148 extern struct vx_info *locate_vx_info(int);
149 extern struct vx_info *locate_or_create_vx_info(int);
151 extern int get_xid_list(int, unsigned int *, int);
152 extern int xid_is_hashed(xid_t);
154 extern int vx_migrate_task(struct task_struct *, struct vx_info *);
156 extern long vs_state_change(struct vx_info *, unsigned int);
159 #endif /* __KERNEL__ */
160 #else /* _VX_CONTEXT_H */
161 #warning duplicate inclusion
162 #endif /* _VX_CONTEXT_H */