Blame view

include/linux/init_task.h 5.19 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

f52111b15   Al Viro   [PATCH] take init...
14
  extern struct files_struct init_files;
18d8fda7c   Al Viro   take init_fs to s...
15
  extern struct fs_struct init_fs;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16

1ec320afd   Cedric Le Goater   [PATCH] add proce...
17
  #define INIT_SIGNALS(sig) {						\
b3ac022cb   Oleg Nesterov   proc: turn signal...
18
  	.nr_threads	= 1,						\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
  	.wait_chldexit	= __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
1ec320afd   Cedric Le Goater   [PATCH] add proce...
20
  	.shared_pending	= { 						\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
  		.list = LIST_HEAD_INIT(sig.shared_pending.list),	\
1ec320afd   Cedric Le Goater   [PATCH] add proce...
22
  		.signal =  {{0}}},					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
23
24
25
  	.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...
26
27
28
29
30
  	.cputimer	= { 						\
  		.cputime = INIT_CPUTIME,				\
  		.running = 0,						\
  		.lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock),	\
  	},								\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
  }
ab516013a   Serge E. Hallyn   [PATCH] namespace...
32
  extern struct nsproxy init_nsproxy;
ab516013a   Serge E. Hallyn   [PATCH] namespace...
33

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

3b7391de6   Serge E. Hallyn   capabilities: int...
73
74
75
76
77
78
  /*
   * Because of the reduced scope of CAP_SETPCAP when filesystem
   * capabilities are in effect, it is safe to allow CAP_SETPCAP to
   * be available in the default configuration.
   */
  # define CAP_INIT_BSET  CAP_FULL_SET
3b7391de6   Serge E. Hallyn   capabilities: int...
79

6b3ef48ad   Paul E. McKenney   rcu: Remove CONFI...
80
  #ifdef CONFIG_TREE_PREEMPT_RCU
f41d911f8   Paul E. McKenney   rcu: Merge preemp...
81
82
83
  #define INIT_TASK_RCU_PREEMPT(tsk)					\
  	.rcu_read_lock_nesting = 0,					\
  	.rcu_read_unlock_special = 0,					\
dd5d19baf   Paul E. McKenney   rcu: Create rcutr...
84
  	.rcu_blocked_node = NULL,					\
f41d911f8   Paul E. McKenney   rcu: Merge preemp...
85
86
87
88
  	.rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry),
  #else
  #define INIT_TASK_RCU_PREEMPT(tsk)
  #endif
b6dff3ec5   David Howells   CRED: Separate ta...
89
  extern struct cred init_cred;
cdd6c482c   Ingo Molnar   perf: Do the big ...
90
91
92
93
94
  #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...
95
  #else
cdd6c482c   Ingo Molnar   perf: Do the big ...
96
  # define INIT_PERF_EVENTS(tsk)
082ff5a27   Peter Zijlstra   perf_counter: Cha...
97
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
98
99
100
101
102
103
104
  /*
   *  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...
105
  	.stack		= &init_thread_info,				\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
106
  	.usage		= ATOMIC_INIT(2),				\
7b34e4283   Oleg Nesterov   introduce PF_KTHR...
107
  	.flags		= PF_KTHREAD,					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
109
110
  	.lock_depth	= -1,						\
  	.prio		= MAX_PRIO-20,					\
  	.static_prio	= MAX_PRIO-20,					\
b29739f90   Ingo Molnar   [PATCH] pi-futex:...
111
  	.normal_prio	= MAX_PRIO-20,					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
112
113
114
115
  	.policy		= SCHED_NORMAL,					\
  	.cpus_allowed	= CPU_MASK_ALL,					\
  	.mm		= NULL,						\
  	.active_mm	= &init_mm,					\
4a55bd5e9   Peter Zijlstra   sched: fair-group...
116
117
118
  	.se		= {						\
  		.group_node 	= LIST_HEAD_INIT(tsk.se.group_node),	\
  	},								\
fa717060f   Peter Zijlstra   sched: sched_rt_e...
119
120
  	.rt		= {						\
  		.run_list	= LIST_HEAD_INIT(tsk.rt.run_list),	\
6f505b164   Peter Zijlstra   sched: rt group s...
121
122
123
  		.time_slice	= HZ, 					\
  		.nr_cpus_allowed = NR_CPUS,				\
  	},								\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
124
  	.tasks		= LIST_HEAD_INIT(tsk.tasks),			\
917b627d4   Gregory Haskins   sched: create "pu...
125
  	.pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
f470021ad   Roland McGrath   ptrace children r...
126
127
  	.ptraced	= LIST_HEAD_INIT(tsk.ptraced),			\
  	.ptrace_entry	= LIST_HEAD_INIT(tsk.ptrace_entry),		\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
129
130
131
132
  	.real_parent	= &tsk,						\
  	.parent		= &tsk,						\
  	.children	= LIST_HEAD_INIT(tsk.children),			\
  	.sibling	= LIST_HEAD_INIT(tsk.sibling),			\
  	.group_leader	= &tsk,						\
3b11a1dec   David Howells   CRED: Differentia...
133
  	.real_cred	= &init_cred,					\
f1752eec6   David Howells   CRED: Detach the ...
134
  	.cred		= &init_cred,					\
5e751e992   David Howells   CRED: Rename cred...
135
136
  	.cred_guard_mutex =						\
  		 __MUTEX_INITIALIZER(tsk.cred_guard_mutex),		\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
137
138
139
140
141
142
  	.comm		= "swapper",					\
  	.thread		= INIT_THREAD,					\
  	.fs		= &init_fs,					\
  	.files		= &init_files,					\
  	.signal		= &init_signals,				\
  	.sighand	= &init_sighand,				\
ab516013a   Serge E. Hallyn   [PATCH] namespace...
143
  	.nsproxy	= &init_nsproxy,				\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
144
145
146
147
  	.pending	= {						\
  		.list = LIST_HEAD_INIT(tsk.pending.list),		\
  		.signal = {{0}}},					\
  	.blocked	= {{0}},					\
e4d919188   Ingo Molnar   [PATCH] lockdep: ...
148
  	.alloc_lock	= __SPIN_LOCK_UNLOCKED(tsk.alloc_lock),		\
b6e3224fb   Linus Torvalds   Revert "task_stru...
149
  	.journal_info	= NULL,						\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
150
  	.cpu_timers	= INIT_CPU_TIMERS(tsk.cpu_timers),		\
22e2c507c   Jens Axboe   [PATCH] Update cf...
151
  	.fs_excl	= ATOMIC_INIT(0),				\
1d6154825   Thomas Gleixner   sched: Convert pi...
152
  	.pi_lock	= __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock),	\
6976675d9   Arjan van de Ven   hrtimer: create a...
153
  	.timer_slack_ns = 50000, /* 50 usec default slack */		\
820e45db2   Sukadev Bhattiprolu   statically initia...
154
155
156
157
158
  	.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...
159
  	.thread_group	= LIST_HEAD_INIT(tsk.thread_group),		\
3e26c149c   Peter Zijlstra   mm: dirty balanci...
160
  	.dirties = INIT_PROP_LOCAL_SINGLE(dirties),			\
bfef93a5d   Al Viro   [PATCH] get rid o...
161
  	INIT_IDS							\
cdd6c482c   Ingo Molnar   perf: Do the big ...
162
  	INIT_PERF_EVENTS(tsk)						\
de30a2b35   Ingo Molnar   [PATCH] lockdep: ...
163
  	INIT_TRACE_IRQFLAGS						\
fbb9ce953   Ingo Molnar   [PATCH] lockdep: ...
164
  	INIT_LOCKDEP							\
5ac9f6226   Steven Rostedt   function-graph: a...
165
  	INIT_FTRACE_GRAPH						\
261842b7c   Steven Rostedt   tracing: add same...
166
  	INIT_TRACE_RECURSION						\
f41d911f8   Paul E. McKenney   rcu: Merge preemp...
167
  	INIT_TASK_RCU_PREEMPT(tsk)					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
168
169
170
171
172
173
174
175
176
  }
  
  
  #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...
177
  /* Attach to the init_task data structure for proper alignment */
2af7687f1   Tim Abbott   Rename .data.init...
178
  #define __init_task_data __attribute__((__section__(".data..init_task")))
857eceebd   Tim Abbott   Add new __init_ta...
179

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
180
181
  
  #endif