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) { \
19 .count = ATOMIC_INIT(1), \
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), \
34 extern struct nsproxy init_nsproxy
;
35 #define INIT_NSPROXY(nsproxy) { \
36 .pid_ns = &init_pid_ns, \
37 .count = ATOMIC_INIT(1), \
38 .uts_ns = &init_uts_ns, \
44 #define INIT_SIGHAND(sighand) { \
45 .count = ATOMIC_INIT(1), \
46 .action = { { { .sa_handler = NULL, } }, }, \
47 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
48 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
51 extern struct group_info init_groups
;
53 #define INIT_STRUCT_PID { \
54 .count = ATOMIC_INIT(1), \
56 { .first = &init_task.pids[PIDTYPE_PID].node }, \
57 { .first = &init_task.pids[PIDTYPE_PGID].node }, \
58 { .first = &init_task.pids[PIDTYPE_SID].node }, \
60 .rcu = RCU_HEAD_INIT, \
65 .pid_chain = { .next = NULL, .pprev = NULL }, \
69 #define INIT_PID_LINK(type) \
73 .pprev = &init_struct_pid.tasks[type].first, \
75 .pid = &init_struct_pid, \
78 #ifdef CONFIG_AUDITSYSCALL
86 #ifdef CONFIG_SECURITY_FILE_CAPABILITIES
88 * Because of the reduced scope of CAP_SETPCAP when filesystem
89 * capabilities are in effect, it is safe to allow CAP_SETPCAP to
90 * be available in the default configuration.
92 # define CAP_INIT_BSET CAP_FULL_SET
94 # define CAP_INIT_BSET CAP_INIT_EFF_SET
97 extern struct cred init_cred
;
99 #ifdef CONFIG_PERF_COUNTERS
100 # define INIT_PERF_COUNTERS(tsk) \
101 .perf_counter_mutex = \
102 __MUTEX_INITIALIZER(tsk.perf_counter_mutex), \
103 .perf_counter_list = LIST_HEAD_INIT(tsk.perf_counter_list),
105 # define INIT_PERF_COUNTERS(tsk)
109 * INIT_TASK is used to set up the first task table, touch at
110 * your own risk!. Base=0, limit=0x1fffff (=2MB)
112 #define INIT_TASK(tsk) \
115 .stack = &init_thread_info, \
116 .usage = ATOMIC_INIT(2), \
117 .flags = PF_KTHREAD, \
119 .prio = MAX_PRIO-20, \
120 .static_prio = MAX_PRIO-20, \
121 .normal_prio = MAX_PRIO-20, \
122 .policy = SCHED_NORMAL, \
123 .cpus_allowed = CPU_MASK_ALL, \
125 .active_mm = &init_mm, \
127 .group_node = LIST_HEAD_INIT(tsk.se.group_node), \
130 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
132 .nr_cpus_allowed = NR_CPUS, \
134 .tasks = LIST_HEAD_INIT(tsk.tasks), \
135 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
136 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
137 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
138 .real_parent = &tsk, \
140 .children = LIST_HEAD_INIT(tsk.children), \
141 .sibling = LIST_HEAD_INIT(tsk.sibling), \
142 .group_leader = &tsk, \
143 .real_cred = &init_cred, \
144 .cred = &init_cred, \
145 .cred_guard_mutex = \
146 __MUTEX_INITIALIZER(tsk.cred_guard_mutex), \
148 .thread = INIT_THREAD, \
150 .files = &init_files, \
151 .signal = &init_signals, \
152 .sighand = &init_sighand, \
153 .nsproxy = &init_nsproxy, \
155 .list = LIST_HEAD_INIT(tsk.pending.list), \
158 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
159 .journal_info = NULL, \
160 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
161 .fs_excl = ATOMIC_INIT(0), \
162 .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
163 .timer_slack_ns = 50000, /* 50 usec default slack */ \
165 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
166 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
167 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
169 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
171 INIT_PERF_COUNTERS(tsk) \
172 INIT_TRACE_IRQFLAGS \
175 INIT_TRACE_RECURSION \
179 #define INIT_CPU_TIMERS(cpu_timers) \
181 LIST_HEAD_INIT(cpu_timers[0]), \
182 LIST_HEAD_INIT(cpu_timers[1]), \
183 LIST_HEAD_INIT(cpu_timers[2]), \