kvm tools, setup: Create private directory
[linux-2.6/next.git] / include / linux / init_task.h
blob580f70c02391712f7cc0351d645361b683b82a8b
1 #ifndef _LINUX__INIT_TASK_H
2 #define _LINUX__INIT_TASK_H
4 #include <linux/rcupdate.h>
5 #include <linux/irqflags.h>
6 #include <linux/utsname.h>
7 #include <linux/lockdep.h>
8 #include <linux/ftrace.h>
9 #include <linux/ipc.h>
10 #include <linux/pid_namespace.h>
11 #include <linux/user_namespace.h>
12 #include <linux/securebits.h>
13 #include <net/net_namespace.h>
15 #ifdef CONFIG_SMP
16 # define INIT_PUSHABLE_TASKS(tsk) \
17 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO),
18 #else
19 # define INIT_PUSHABLE_TASKS(tsk)
20 #endif
22 extern struct files_struct init_files;
23 extern struct fs_struct init_fs;
25 #ifdef CONFIG_CGROUPS
26 #define INIT_THREADGROUP_FORK_LOCK(sig) \
27 .threadgroup_fork_lock = \
28 __RWSEM_INITIALIZER(sig.threadgroup_fork_lock),
29 #else
30 #define INIT_THREADGROUP_FORK_LOCK(sig)
31 #endif
33 #define INIT_SIGNALS(sig) { \
34 .nr_threads = 1, \
35 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
36 .shared_pending = { \
37 .list = LIST_HEAD_INIT(sig.shared_pending.list), \
38 .signal = {{0}}}, \
39 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
40 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
41 .rlim = INIT_RLIMITS, \
42 .cputimer = { \
43 .cputime = INIT_CPUTIME, \
44 .running = 0, \
45 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \
46 }, \
47 .cred_guard_mutex = \
48 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
49 INIT_THREADGROUP_FORK_LOCK(sig) \
52 extern struct nsproxy init_nsproxy;
54 #define INIT_SIGHAND(sighand) { \
55 .count = ATOMIC_INIT(1), \
56 .action = { { { .sa_handler = SIG_DFL, } }, }, \
57 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
58 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
61 extern struct group_info init_groups;
63 #define INIT_STRUCT_PID { \
64 .count = ATOMIC_INIT(1), \
65 .tasks = { \
66 { .first = NULL }, \
67 { .first = NULL }, \
68 { .first = NULL }, \
69 }, \
70 .level = 0, \
71 .numbers = { { \
72 .nr = 0, \
73 .ns = &init_pid_ns, \
74 .pid_chain = { .next = NULL, .pprev = NULL }, \
75 }, } \
78 #define INIT_PID_LINK(type) \
79 { \
80 .node = { \
81 .next = NULL, \
82 .pprev = NULL, \
83 }, \
84 .pid = &init_struct_pid, \
87 #ifdef CONFIG_AUDITSYSCALL
88 #define INIT_IDS \
89 .loginuid = -1, \
90 .sessionid = -1,
91 #else
92 #define INIT_IDS
93 #endif
95 #ifdef CONFIG_RCU_BOOST
96 #define INIT_TASK_RCU_BOOST() \
97 .rcu_boost_mutex = NULL,
98 #else
99 #define INIT_TASK_RCU_BOOST()
100 #endif
101 #ifdef CONFIG_TREE_PREEMPT_RCU
102 #define INIT_TASK_RCU_TREE_PREEMPT() \
103 .rcu_blocked_node = NULL,
104 #else
105 #define INIT_TASK_RCU_TREE_PREEMPT(tsk)
106 #endif
107 #ifdef CONFIG_PREEMPT_RCU
108 #define INIT_TASK_RCU_PREEMPT(tsk) \
109 .rcu_read_lock_nesting = 0, \
110 .rcu_read_unlock_special = 0, \
111 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
112 INIT_TASK_RCU_TREE_PREEMPT() \
113 INIT_TASK_RCU_BOOST()
114 #else
115 #define INIT_TASK_RCU_PREEMPT(tsk)
116 #endif
118 extern struct cred init_cred;
120 #ifdef CONFIG_PERF_EVENTS
121 # define INIT_PERF_EVENTS(tsk) \
122 .perf_event_mutex = \
123 __MUTEX_INITIALIZER(tsk.perf_event_mutex), \
124 .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
125 #else
126 # define INIT_PERF_EVENTS(tsk)
127 #endif
130 * INIT_TASK is used to set up the first task table, touch at
131 * your own risk!. Base=0, limit=0x1fffff (=2MB)
133 #define INIT_TASK(tsk) \
135 .state = 0, \
136 .stack = &init_thread_info, \
137 .usage = ATOMIC_INIT(2), \
138 .flags = PF_KTHREAD, \
139 .prio = MAX_PRIO-20, \
140 .static_prio = MAX_PRIO-20, \
141 .normal_prio = MAX_PRIO-20, \
142 .policy = SCHED_NORMAL, \
143 .cpus_allowed = CPU_MASK_ALL, \
144 .mm = NULL, \
145 .active_mm = &init_mm, \
146 .se = { \
147 .group_node = LIST_HEAD_INIT(tsk.se.group_node), \
148 }, \
149 .rt = { \
150 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
151 .time_slice = HZ, \
152 .nr_cpus_allowed = NR_CPUS, \
153 }, \
154 .tasks = LIST_HEAD_INIT(tsk.tasks), \
155 INIT_PUSHABLE_TASKS(tsk) \
156 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
157 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
158 .real_parent = &tsk, \
159 .parent = &tsk, \
160 .children = LIST_HEAD_INIT(tsk.children), \
161 .sibling = LIST_HEAD_INIT(tsk.sibling), \
162 .group_leader = &tsk, \
163 RCU_INIT_POINTER(.real_cred, &init_cred), \
164 RCU_INIT_POINTER(.cred, &init_cred), \
165 .comm = "swapper", \
166 .thread = INIT_THREAD, \
167 .fs = &init_fs, \
168 .files = &init_files, \
169 .signal = &init_signals, \
170 .sighand = &init_sighand, \
171 .nsproxy = &init_nsproxy, \
172 .pending = { \
173 .list = LIST_HEAD_INIT(tsk.pending.list), \
174 .signal = {{0}}}, \
175 .blocked = {{0}}, \
176 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
177 .journal_info = NULL, \
178 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
179 .fs_excl = ATOMIC_INIT(0), \
180 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
181 .timer_slack_ns = 50000, /* 50 usec default slack */ \
182 .pids = { \
183 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
184 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
185 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
186 }, \
187 .thread_group = LIST_HEAD_INIT(tsk.thread_group), \
188 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
189 INIT_IDS \
190 INIT_PERF_EVENTS(tsk) \
191 INIT_TRACE_IRQFLAGS \
192 INIT_LOCKDEP \
193 INIT_FTRACE_GRAPH \
194 INIT_TRACE_RECURSION \
195 INIT_TASK_RCU_PREEMPT(tsk) \
199 #define INIT_CPU_TIMERS(cpu_timers) \
201 LIST_HEAD_INIT(cpu_timers[0]), \
202 LIST_HEAD_INIT(cpu_timers[1]), \
203 LIST_HEAD_INIT(cpu_timers[2]), \
206 /* Attach to the init_task data structure for proper alignment */
207 #define __init_task_data __attribute__((__section__(".data..init_task")))
210 #endif