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_MM(name) \
21 .pgd = swapper_pg_dir, \
22 .mm_users = ATOMIC_INIT(2), \
23 .mm_count = ATOMIC_INIT(1), \
24 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
25 .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
26 .mmlist = LIST_HEAD_INIT(name.mmlist), \
27 .cpu_vm_mask = CPU_MASK_ALL, \
30 #define INIT_SIGNALS(sig) { \
31 .count = ATOMIC_INIT(1), \
32 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
34 .list = LIST_HEAD_INIT(sig.shared_pending.list), \
36 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
37 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
38 .rlim = INIT_RLIMITS, \
40 .cputime = INIT_CPUTIME, \
42 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \
46 extern struct nsproxy init_nsproxy;
47 #define INIT_NSPROXY(nsproxy) { \
48 .pid_ns = &init_pid_ns, \
49 .count = ATOMIC_INIT(1), \
50 .uts_ns = &init_uts_ns, \
56 #define INIT_SIGHAND(sighand) { \
57 .count = ATOMIC_INIT(1), \
58 .action = { { { .sa_handler = NULL, } }, }, \
59 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
60 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
63 extern struct group_info init_groups;
65 #define INIT_STRUCT_PID { \
66 .count = ATOMIC_INIT(1), \
68 { .first = &init_task.pids[PIDTYPE_PID].node }, \
69 { .first = &init_task.pids[PIDTYPE_PGID].node }, \
70 { .first = &init_task.pids[PIDTYPE_SID].node }, \
72 .rcu = RCU_HEAD_INIT, \
77 .pid_chain = { .next = NULL, .pprev = NULL }, \
81 #define INIT_PID_LINK(type) \
85 .pprev = &init_struct_pid.tasks[type].first, \
87 .pid = &init_struct_pid, \
90 #ifdef CONFIG_AUDITSYSCALL
98 #ifdef CONFIG_SECURITY_FILE_CAPABILITIES
100 * Because of the reduced scope of CAP_SETPCAP when filesystem
101 * capabilities are in effect, it is safe to allow CAP_SETPCAP to
102 * be available in the default configuration.
104 # define CAP_INIT_BSET CAP_FULL_SET
106 # define CAP_INIT_BSET CAP_INIT_EFF_SET
109 extern struct cred init_cred;
112 * INIT_TASK is used to set up the first task table, touch at
113 * your own risk!. Base=0, limit=0x1fffff (=2MB)
115 #define INIT_TASK(tsk) \
118 .stack = &init_thread_info, \
119 .usage = ATOMIC_INIT(2), \
120 .flags = PF_KTHREAD, \
122 .prio = MAX_PRIO-20, \
123 .static_prio = MAX_PRIO-20, \
124 .normal_prio = MAX_PRIO-20, \
125 .policy = SCHED_NORMAL, \
126 .cpus_allowed = CPU_MASK_ALL, \
128 .active_mm = &init_mm, \
130 .group_node = LIST_HEAD_INIT(tsk.se.group_node), \
133 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
135 .nr_cpus_allowed = NR_CPUS, \
137 .tasks = LIST_HEAD_INIT(tsk.tasks), \
138 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
139 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
140 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
141 .real_parent = &tsk, \
143 .children = LIST_HEAD_INIT(tsk.children), \
144 .sibling = LIST_HEAD_INIT(tsk.sibling), \
145 .group_leader = &tsk, \
146 .real_cred = &init_cred, \
147 .cred = &init_cred, \
148 .cred_guard_mutex = \
149 __MUTEX_INITIALIZER(tsk.cred_guard_mutex), \
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 = __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 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
174 INIT_TRACE_IRQFLAGS \
177 INIT_TRACE_RECURSION \
181 #define INIT_CPU_TIMERS(cpu_timers) \
183 LIST_HEAD_INIT(cpu_timers[0]), \
184 LIST_HEAD_INIT(cpu_timers[1]), \
185 LIST_HEAD_INIT(cpu_timers[2]), \