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>
15 extern struct files_struct init_files
;
16 extern struct fs_struct init_fs
;
18 #define INIT_SIGNALS(sig) { \
20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
22 .list = LIST_HEAD_INIT(sig.shared_pending.list), \
24 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
25 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
26 .rlim = INIT_RLIMITS, \
28 .cputime = INIT_CPUTIME, \
30 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \
33 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
36 extern struct nsproxy init_nsproxy
;
38 #define INIT_SIGHAND(sighand) { \
39 .count = ATOMIC_INIT(1), \
40 .action = { { { .sa_handler = SIG_DFL, } }, }, \
41 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
42 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
45 extern struct group_info init_groups
;
47 #define INIT_STRUCT_PID { \
48 .count = ATOMIC_INIT(1), \
58 .pid_chain = { .next = NULL, .pprev = NULL }, \
62 #define INIT_PID_LINK(type) \
68 .pid = &init_struct_pid, \
71 #ifdef CONFIG_AUDITSYSCALL
80 * Because of the reduced scope of CAP_SETPCAP when filesystem
81 * capabilities are in effect, it is safe to allow CAP_SETPCAP to
82 * be available in the default configuration.
84 # define CAP_INIT_BSET CAP_FULL_SET
86 #ifdef CONFIG_TREE_PREEMPT_RCU
87 #define INIT_TASK_RCU_TREE_PREEMPT() \
88 .rcu_blocked_node = NULL,
90 #define INIT_TASK_RCU_TREE_PREEMPT(tsk)
92 #ifdef CONFIG_PREEMPT_RCU
93 #define INIT_TASK_RCU_PREEMPT(tsk) \
94 .rcu_read_lock_nesting = 0, \
95 .rcu_read_unlock_special = 0, \
96 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
97 INIT_TASK_RCU_TREE_PREEMPT()
99 #define INIT_TASK_RCU_PREEMPT(tsk)
102 extern struct cred init_cred
;
104 #ifdef CONFIG_PERF_EVENTS
105 # define INIT_PERF_EVENTS(tsk) \
106 .perf_event_mutex = \
107 __MUTEX_INITIALIZER(tsk.perf_event_mutex), \
108 .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
110 # define INIT_PERF_EVENTS(tsk)
114 * INIT_TASK is used to set up the first task table, touch at
115 * your own risk!. Base=0, limit=0x1fffff (=2MB)
117 #define INIT_TASK(tsk) \
120 .stack = &init_thread_info, \
121 .usage = ATOMIC_INIT(2), \
122 .flags = PF_KTHREAD, \
124 .prio = MAX_PRIO-20, \
125 .static_prio = MAX_PRIO-20, \
126 .normal_prio = MAX_PRIO-20, \
127 .policy = SCHED_NORMAL, \
128 .cpus_allowed = CPU_MASK_ALL, \
130 .active_mm = &init_mm, \
132 .group_node = LIST_HEAD_INIT(tsk.se.group_node), \
135 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
137 .nr_cpus_allowed = NR_CPUS, \
139 .tasks = LIST_HEAD_INIT(tsk.tasks), \
140 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
141 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
142 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
143 .real_parent = &tsk, \
145 .children = LIST_HEAD_INIT(tsk.children), \
146 .sibling = LIST_HEAD_INIT(tsk.sibling), \
147 .group_leader = &tsk, \
148 RCU_INIT_POINTER(.real_cred, &init_cred), \
149 RCU_INIT_POINTER(.cred, &init_cred), \
151 .thread = INIT_THREAD, \
153 .files = &init_files, \
154 .signal = &init_signals, \
155 .sighand = &init_sighand, \
156 .nsproxy = &init_nsproxy, \
158 .list = LIST_HEAD_INIT(tsk.pending.list), \
161 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
162 .journal_info = NULL, \
163 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
164 .fs_excl = ATOMIC_INIT(0), \
165 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
166 .timer_slack_ns = 50000, /* 50 usec default slack */ \
168 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
169 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
170 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
172 .thread_group = LIST_HEAD_INIT(tsk.thread_group), \
173 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
175 INIT_PERF_EVENTS(tsk) \
176 INIT_TRACE_IRQFLAGS \
179 INIT_TRACE_RECURSION \
180 INIT_TASK_RCU_PREEMPT(tsk) \
184 #define INIT_CPU_TIMERS(cpu_timers) \
186 LIST_HEAD_INIT(cpu_timers[0]), \
187 LIST_HEAD_INIT(cpu_timers[1]), \
188 LIST_HEAD_INIT(cpu_timers[2]), \
191 /* Attach to the init_task data structure for proper alignment */
192 #define __init_task_data __attribute__((__section__(".data..init_task")))