Blame view

include/linux/init_task.h 5.56 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX__INIT_TASK_H
  #define _LINUX__INIT_TASK_H
ab2af1f50   Dipankar Sarma   [PATCH] files: fi...
3
  #include <linux/rcupdate.h>
de30a2b35   Ingo Molnar   [PATCH] lockdep: ...
4
  #include <linux/irqflags.h>
4865ecf13   Serge E. Hallyn   [PATCH] namespace...
5
  #include <linux/utsname.h>
fbb9ce953   Ingo Molnar   [PATCH] lockdep: ...
6
  #include <linux/lockdep.h>
5ac9f6226   Steven Rostedt   function-graph: a...
7
  #include <linux/ftrace.h>
73ea41302   Kirill Korotaev   [PATCH] IPC names...
8
  #include <linux/ipc.h>
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
9
  #include <linux/pid_namespace.h>
acce292c8   Cedric Le Goater   user namespace: a...
10
  #include <linux/user_namespace.h>
3898b1b4e   Andrew G. Morgan   capabilities: imp...
11
  #include <linux/securebits.h>
772698f63   Eric W. Biederman   [NET]: Add a netw...
12
  #include <net/net_namespace.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13

806c09a7d   Dario Faggioli   sched: Make pusha...
14
15
16
17
18
19
  #ifdef CONFIG_SMP
  # define INIT_PUSHABLE_TASKS(tsk)					\
  	.pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO),
  #else
  # define INIT_PUSHABLE_TASKS(tsk)
  #endif
f52111b15   Al Viro   [PATCH] take init...
20
  extern struct files_struct init_files;
18d8fda7c   Al Viro   take init_fs to s...
21
  extern struct fs_struct init_fs;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22

4714d1d32   Ben Blum   cgroups: read-wri...
23
  #ifdef CONFIG_CGROUPS
257058ae2   Tejun Heo   threadgroup: rena...
24
25
  #define INIT_GROUP_RWSEM(sig)						\
  	.group_rwsem = __RWSEM_INITIALIZER(sig.group_rwsem),
4714d1d32   Ben Blum   cgroups: read-wri...
26
  #else
257058ae2   Tejun Heo   threadgroup: rena...
27
  #define INIT_GROUP_RWSEM(sig)
4714d1d32   Ben Blum   cgroups: read-wri...
28
  #endif
1ec320afd   Cedric Le Goater   [PATCH] add proce...
29
  #define INIT_SIGNALS(sig) {						\
b3ac022cb   Oleg Nesterov   proc: turn signal...
30
  	.nr_threads	= 1,						\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
  	.wait_chldexit	= __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
1ec320afd   Cedric Le Goater   [PATCH] add proce...
32
  	.shared_pending	= { 						\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
  		.list = LIST_HEAD_INIT(sig.shared_pending.list),	\
1ec320afd   Cedric Le Goater   [PATCH] add proce...
34
  		.signal =  {{0}}},					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
36
37
  	.posix_timers	 = LIST_HEAD_INIT(sig.posix_timers),		\
  	.cpu_timers	= INIT_CPU_TIMERS(sig.cpu_timers),		\
  	.rlim		= INIT_RLIMITS,					\
4cd4c1b40   Peter Zijlstra   timers: split pro...
38
39
40
  	.cputimer	= { 						\
  		.cputime = INIT_CPUTIME,				\
  		.running = 0,						\
ee30a7b2f   Thomas Gleixner   locking, sched: A...
41
  		.lock = __RAW_SPIN_LOCK_UNLOCKED(sig.cputimer.lock),	\
4cd4c1b40   Peter Zijlstra   timers: split pro...
42
  	},								\
9b1bf12d5   KOSAKI Motohiro   signals: move cre...
43
44
  	.cred_guard_mutex =						\
  		 __MUTEX_INITIALIZER(sig.cred_guard_mutex),		\
257058ae2   Tejun Heo   threadgroup: rena...
45
  	INIT_GROUP_RWSEM(sig)						\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
  }
ab516013a   Serge E. Hallyn   [PATCH] namespace...
47
  extern struct nsproxy init_nsproxy;
ab516013a   Serge E. Hallyn   [PATCH] namespace...
48

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
50
  #define INIT_SIGHAND(sighand) {						\
  	.count		= ATOMIC_INIT(1), 				\
0a14a130c   Oleg Nesterov   INIT_SIGHAND: use...
51
  	.action		= { { { .sa_handler = SIG_DFL, } }, },		\
e4d919188   Ingo Molnar   [PATCH] lockdep: ...
52
  	.siglock	= __SPIN_LOCK_UNLOCKED(sighand.siglock),	\
b8fceee17   Davide Libenzi   signalfd simplifi...
53
  	.signalfd_wqh	= __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh),	\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
55
56
  }
  
  extern struct group_info init_groups;
820e45db2   Sukadev Bhattiprolu   statically initia...
57
58
  #define INIT_STRUCT_PID {						\
  	.count 		= ATOMIC_INIT(1),				\
820e45db2   Sukadev Bhattiprolu   statically initia...
59
  	.tasks		= {						\
f20011457   Oleg Nesterov   pids: init_struct...
60
61
62
  		{ .first = NULL },					\
  		{ .first = NULL },					\
  		{ .first = NULL },					\
820e45db2   Sukadev Bhattiprolu   statically initia...
63
  	},								\
4c3f2ead5   Sukadev Bhattiprolu   pid namespaces: i...
64
65
66
67
68
69
  	.level		= 0,						\
  	.numbers	= { {						\
  		.nr		= 0,					\
  		.ns		= &init_pid_ns,				\
  		.pid_chain	= { .next = NULL, .pprev = NULL },	\
  	}, }								\
820e45db2   Sukadev Bhattiprolu   statically initia...
70
71
72
73
74
75
  }
  
  #define INIT_PID_LINK(type) 					\
  {								\
  	.node = {						\
  		.next = NULL,					\
f20011457   Oleg Nesterov   pids: init_struct...
76
  		.pprev = NULL,					\
820e45db2   Sukadev Bhattiprolu   statically initia...
77
78
79
  	},							\
  	.pid = &init_struct_pid,				\
  }
bfef93a5d   Al Viro   [PATCH] get rid o...
80
81
  #ifdef CONFIG_AUDITSYSCALL
  #define INIT_IDS \
4746ec5b0   Eric Paris   [AUDIT] add sessi...
82
83
  	.loginuid = -1, \
  	.sessionid = -1,
bfef93a5d   Al Viro   [PATCH] get rid o...
84
85
86
  #else
  #define INIT_IDS
  #endif
3b7391de6   Serge E. Hallyn   capabilities: int...
87

24278d148   Paul E. McKenney   rcu: priority boo...
88
89
90
91
92
93
  #ifdef CONFIG_RCU_BOOST
  #define INIT_TASK_RCU_BOOST()						\
  	.rcu_boost_mutex = NULL,
  #else
  #define INIT_TASK_RCU_BOOST()
  #endif
6b3ef48ad   Paul E. McKenney   rcu: Remove CONFI...
94
  #ifdef CONFIG_TREE_PREEMPT_RCU
a57eb940d   Paul E. McKenney   rcu: Add a TINY_P...
95
96
97
98
99
100
  #define INIT_TASK_RCU_TREE_PREEMPT()					\
  	.rcu_blocked_node = NULL,
  #else
  #define INIT_TASK_RCU_TREE_PREEMPT(tsk)
  #endif
  #ifdef CONFIG_PREEMPT_RCU
f41d911f8   Paul E. McKenney   rcu: Merge preemp...
101
102
103
  #define INIT_TASK_RCU_PREEMPT(tsk)					\
  	.rcu_read_lock_nesting = 0,					\
  	.rcu_read_unlock_special = 0,					\
a57eb940d   Paul E. McKenney   rcu: Add a TINY_P...
104
  	.rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry),		\
24278d148   Paul E. McKenney   rcu: priority boo...
105
106
  	INIT_TASK_RCU_TREE_PREEMPT()					\
  	INIT_TASK_RCU_BOOST()
f41d911f8   Paul E. McKenney   rcu: Merge preemp...
107
108
109
  #else
  #define INIT_TASK_RCU_PREEMPT(tsk)
  #endif
b6dff3ec5   David Howells   CRED: Separate ta...
110
  extern struct cred init_cred;
cdd6c482c   Ingo Molnar   perf: Do the big ...
111
112
113
114
115
  #ifdef CONFIG_PERF_EVENTS
  # define INIT_PERF_EVENTS(tsk)					\
  	.perf_event_mutex = 						\
  		 __MUTEX_INITIALIZER(tsk.perf_event_mutex),		\
  	.perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
082ff5a27   Peter Zijlstra   perf_counter: Cha...
116
  #else
cdd6c482c   Ingo Molnar   perf: Do the big ...
117
  # define INIT_PERF_EVENTS(tsk)
082ff5a27   Peter Zijlstra   perf_counter: Cha...
118
  #endif
f1c6f1a7e   Carsten Emde   sched: Set the co...
119
  #define INIT_TASK_COMM "swapper"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
120
121
122
123
124
125
126
  /*
   *  INIT_TASK is used to set up the first task table, touch at
   * your own risk!. Base=0, limit=0x1fffff (=2MB)
   */
  #define INIT_TASK(tsk)	\
  {									\
  	.state		= 0,						\
f7e4217b0   Roman Zippel   rename thread_inf...
127
  	.stack		= &init_thread_info,				\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
  	.usage		= ATOMIC_INIT(2),				\
7b34e4283   Oleg Nesterov   introduce PF_KTHR...
129
  	.flags		= PF_KTHREAD,					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
130
131
  	.prio		= MAX_PRIO-20,					\
  	.static_prio	= MAX_PRIO-20,					\
b29739f90   Ingo Molnar   [PATCH] pi-futex:...
132
  	.normal_prio	= MAX_PRIO-20,					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
133
134
135
136
  	.policy		= SCHED_NORMAL,					\
  	.cpus_allowed	= CPU_MASK_ALL,					\
  	.mm		= NULL,						\
  	.active_mm	= &init_mm,					\
4a55bd5e9   Peter Zijlstra   sched: fair-group...
137
138
139
  	.se		= {						\
  		.group_node 	= LIST_HEAD_INIT(tsk.se.group_node),	\
  	},								\
fa717060f   Peter Zijlstra   sched: sched_rt_e...
140
141
  	.rt		= {						\
  		.run_list	= LIST_HEAD_INIT(tsk.rt.run_list),	\
6f505b164   Peter Zijlstra   sched: rt group s...
142
143
144
  		.time_slice	= HZ, 					\
  		.nr_cpus_allowed = NR_CPUS,				\
  	},								\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
145
  	.tasks		= LIST_HEAD_INIT(tsk.tasks),			\
806c09a7d   Dario Faggioli   sched: Make pusha...
146
  	INIT_PUSHABLE_TASKS(tsk)					\
f470021ad   Roland McGrath   ptrace children r...
147
148
  	.ptraced	= LIST_HEAD_INIT(tsk.ptraced),			\
  	.ptrace_entry	= LIST_HEAD_INIT(tsk.ptrace_entry),		\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
149
150
151
152
153
  	.real_parent	= &tsk,						\
  	.parent		= &tsk,						\
  	.children	= LIST_HEAD_INIT(tsk.children),			\
  	.sibling	= LIST_HEAD_INIT(tsk.sibling),			\
  	.group_leader	= &tsk,						\
4d2deb40b   Arnd Bergmann   kernel: __rcu ann...
154
155
  	RCU_INIT_POINTER(.real_cred, &init_cred),			\
  	RCU_INIT_POINTER(.cred, &init_cred),				\
f1c6f1a7e   Carsten Emde   sched: Set the co...
156
  	.comm		= INIT_TASK_COMM,				\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
157
158
159
160
161
  	.thread		= INIT_THREAD,					\
  	.fs		= &init_fs,					\
  	.files		= &init_files,					\
  	.signal		= &init_signals,				\
  	.sighand	= &init_sighand,				\
ab516013a   Serge E. Hallyn   [PATCH] namespace...
162
  	.nsproxy	= &init_nsproxy,				\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
163
164
165
166
  	.pending	= {						\
  		.list = LIST_HEAD_INIT(tsk.pending.list),		\
  		.signal = {{0}}},					\
  	.blocked	= {{0}},					\
e4d919188   Ingo Molnar   [PATCH] lockdep: ...
167
  	.alloc_lock	= __SPIN_LOCK_UNLOCKED(tsk.alloc_lock),		\
b6e3224fb   Linus Torvalds   Revert "task_stru...
168
  	.journal_info	= NULL,						\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
169
  	.cpu_timers	= INIT_CPU_TIMERS(tsk.cpu_timers),		\
1d6154825   Thomas Gleixner   sched: Convert pi...
170
  	.pi_lock	= __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock),	\
6976675d9   Arjan van de Ven   hrtimer: create a...
171
  	.timer_slack_ns = 50000, /* 50 usec default slack */		\
820e45db2   Sukadev Bhattiprolu   statically initia...
172
173
174
175
176
  	.pids = {							\
  		[PIDTYPE_PID]  = INIT_PID_LINK(PIDTYPE_PID),		\
  		[PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID),		\
  		[PIDTYPE_SID]  = INIT_PID_LINK(PIDTYPE_SID),		\
  	},								\
fa2755e20   Oleg Nesterov   INIT_TASK() shoul...
177
  	.thread_group	= LIST_HEAD_INIT(tsk.thread_group),		\
bfef93a5d   Al Viro   [PATCH] get rid o...
178
  	INIT_IDS							\
cdd6c482c   Ingo Molnar   perf: Do the big ...
179
  	INIT_PERF_EVENTS(tsk)						\
de30a2b35   Ingo Molnar   [PATCH] lockdep: ...
180
  	INIT_TRACE_IRQFLAGS						\
fbb9ce953   Ingo Molnar   [PATCH] lockdep: ...
181
  	INIT_LOCKDEP							\
5ac9f6226   Steven Rostedt   function-graph: a...
182
  	INIT_FTRACE_GRAPH						\
261842b7c   Steven Rostedt   tracing: add same...
183
  	INIT_TRACE_RECURSION						\
f41d911f8   Paul E. McKenney   rcu: Merge preemp...
184
  	INIT_TASK_RCU_PREEMPT(tsk)					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
185
186
187
188
189
190
191
192
193
  }
  
  
  #define INIT_CPU_TIMERS(cpu_timers)					\
  {									\
  	LIST_HEAD_INIT(cpu_timers[0]),					\
  	LIST_HEAD_INIT(cpu_timers[1]),					\
  	LIST_HEAD_INIT(cpu_timers[2]),					\
  }
857eceebd   Tim Abbott   Add new __init_ta...
194
  /* Attach to the init_task data structure for proper alignment */
2af7687f1   Tim Abbott   Rename .data.init...
195
  #define __init_task_data __attribute__((__section__(".data..init_task")))
857eceebd   Tim Abbott   Add new __init_ta...
196

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
197
198
  
  #endif