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>
10 #include <linux/pid_namespace.h>
11 #include <linux/user_namespace.h>
12 #include <linux/securebits.h>
13 #include <net/net_namespace.h>
16 # define INIT_PUSHABLE_TASKS(tsk) \
17 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO),
19 # define INIT_PUSHABLE_TASKS(tsk)
22 extern struct files_struct init_files
;
23 extern struct fs_struct init_fs
;
25 #define INIT_SIGNALS(sig) { \
27 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
29 .list = LIST_HEAD_INIT(sig.shared_pending.list), \
31 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
32 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
33 .rlim = INIT_RLIMITS, \
35 .cputime = INIT_CPUTIME, \
37 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \
40 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
43 extern struct nsproxy init_nsproxy
;
45 #define INIT_SIGHAND(sighand) { \
46 .count = ATOMIC_INIT(1), \
47 .action = { { { .sa_handler = SIG_DFL, } }, }, \
48 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
49 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
52 extern struct group_info init_groups
;
54 #define INIT_STRUCT_PID { \
55 .count = ATOMIC_INIT(1), \
65 .pid_chain = { .next = NULL, .pprev = NULL }, \
69 #define INIT_PID_LINK(type) \
75 .pid = &init_struct_pid, \
78 #ifdef CONFIG_AUDITSYSCALL
86 #ifdef CONFIG_RCU_BOOST
87 #define INIT_TASK_RCU_BOOST() \
88 .rcu_boost_mutex = NULL,
90 #define INIT_TASK_RCU_BOOST()
92 #ifdef CONFIG_TREE_PREEMPT_RCU
93 #define INIT_TASK_RCU_TREE_PREEMPT() \
94 .rcu_blocked_node = NULL,
96 #define INIT_TASK_RCU_TREE_PREEMPT(tsk)
98 #ifdef CONFIG_PREEMPT_RCU
99 #define INIT_TASK_RCU_PREEMPT(tsk) \
100 .rcu_read_lock_nesting = 0, \
101 .rcu_read_unlock_special = 0, \
102 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
103 INIT_TASK_RCU_TREE_PREEMPT() \
104 INIT_TASK_RCU_BOOST()
106 #define INIT_TASK_RCU_PREEMPT(tsk)
109 extern struct cred init_cred
;
111 #ifdef CONFIG_PERF_EVENTS
112 # define INIT_PERF_EVENTS(tsk) \
113 .perf_event_mutex = \
114 __MUTEX_INITIALIZER(tsk.perf_event_mutex), \
115 .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
117 # define INIT_PERF_EVENTS(tsk)
121 * INIT_TASK is used to set up the first task table, touch at
122 * your own risk!. Base=0, limit=0x1fffff (=2MB)
124 #define INIT_TASK(tsk) \
127 .stack = &init_thread_info, \
128 .usage = ATOMIC_INIT(2), \
129 .flags = PF_KTHREAD, \
130 .prio = MAX_PRIO-20, \
131 .static_prio = MAX_PRIO-20, \
132 .normal_prio = MAX_PRIO-20, \
133 .policy = SCHED_NORMAL, \
134 .cpus_allowed = CPU_MASK_ALL, \
136 .active_mm = &init_mm, \
138 .group_node = LIST_HEAD_INIT(tsk.se.group_node), \
141 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
143 .nr_cpus_allowed = NR_CPUS, \
145 .tasks = LIST_HEAD_INIT(tsk.tasks), \
146 INIT_PUSHABLE_TASKS(tsk) \
147 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
148 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
149 .real_parent = &tsk, \
151 .children = LIST_HEAD_INIT(tsk.children), \
152 .sibling = LIST_HEAD_INIT(tsk.sibling), \
153 .group_leader = &tsk, \
154 RCU_INIT_POINTER(.real_cred, &init_cred), \
155 RCU_INIT_POINTER(.cred, &init_cred), \
157 .thread = INIT_THREAD, \
159 .files = &init_files, \
160 .signal = &init_signals, \
161 .sighand = &init_sighand, \
162 .nsproxy = &init_nsproxy, \
164 .list = LIST_HEAD_INIT(tsk.pending.list), \
167 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
168 .journal_info = NULL, \
169 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
170 .fs_excl = ATOMIC_INIT(0), \
171 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
172 .timer_slack_ns = 50000, /* 50 usec default slack */ \
174 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
175 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
176 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
178 .thread_group = LIST_HEAD_INIT(tsk.thread_group), \
179 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
181 INIT_PERF_EVENTS(tsk) \
182 INIT_TRACE_IRQFLAGS \
185 INIT_TRACE_RECURSION \
186 INIT_TASK_RCU_PREEMPT(tsk) \
190 #define INIT_CPU_TIMERS(cpu_timers) \
192 LIST_HEAD_INIT(cpu_timers[0]), \
193 LIST_HEAD_INIT(cpu_timers[1]), \
194 LIST_HEAD_INIT(cpu_timers[2]), \
197 /* Attach to the init_task data structure for proper alignment */
198 #define __init_task_data __attribute__((__section__(".data..init_task")))