]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/linux/init_task.h
8139cp: fix checksum broken
[net-next-2.6.git] / include / linux / init_task.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX__INIT_TASK_H
2#define _LINUX__INIT_TASK_H
3
ab2af1f5 4#include <linux/rcupdate.h>
de30a2b3 5#include <linux/irqflags.h>
4865ecf1 6#include <linux/utsname.h>
fbb9ce95 7#include <linux/lockdep.h>
5ac9f622 8#include <linux/ftrace.h>
73ea4130 9#include <linux/ipc.h>
9a575a92 10#include <linux/pid_namespace.h>
acce292c 11#include <linux/user_namespace.h>
3898b1b4 12#include <linux/securebits.h>
772698f6 13#include <net/net_namespace.h>
1da177e4 14
f52111b1 15extern struct files_struct init_files;
18d8fda7 16extern struct fs_struct init_fs;
1da177e4 17
1ec320af 18#define INIT_SIGNALS(sig) { \
b3ac022c 19 .nr_threads = 1, \
1da177e4 20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
1ec320af 21 .shared_pending = { \
1da177e4 22 .list = LIST_HEAD_INIT(sig.shared_pending.list), \
1ec320af 23 .signal = {{0}}}, \
1da177e4
LT
24 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
25 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
26 .rlim = INIT_RLIMITS, \
4cd4c1b4
PZ
27 .cputimer = { \
28 .cputime = INIT_CPUTIME, \
29 .running = 0, \
30 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \
31 }, \
9b1bf12d
KM
32 .cred_guard_mutex = \
33 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
1da177e4
LT
34}
35
ab516013 36extern struct nsproxy init_nsproxy;
ab516013 37
1da177e4
LT
38#define INIT_SIGHAND(sighand) { \
39 .count = ATOMIC_INIT(1), \
0a14a130 40 .action = { { { .sa_handler = SIG_DFL, } }, }, \
e4d91918 41 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
b8fceee1 42 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
1da177e4
LT
43}
44
45extern struct group_info init_groups;
46
820e45db
SB
47#define INIT_STRUCT_PID { \
48 .count = ATOMIC_INIT(1), \
820e45db 49 .tasks = { \
f2001145
ON
50 { .first = NULL }, \
51 { .first = NULL }, \
52 { .first = NULL }, \
820e45db 53 }, \
4c3f2ead
SB
54 .level = 0, \
55 .numbers = { { \
56 .nr = 0, \
57 .ns = &init_pid_ns, \
58 .pid_chain = { .next = NULL, .pprev = NULL }, \
59 }, } \
820e45db
SB
60}
61
62#define INIT_PID_LINK(type) \
63{ \
64 .node = { \
65 .next = NULL, \
f2001145 66 .pprev = NULL, \
820e45db
SB
67 }, \
68 .pid = &init_struct_pid, \
69}
70
bfef93a5
AV
71#ifdef CONFIG_AUDITSYSCALL
72#define INIT_IDS \
4746ec5b
EP
73 .loginuid = -1, \
74 .sessionid = -1,
bfef93a5
AV
75#else
76#define INIT_IDS
77#endif
3b7391de 78
3b7391de
SH
79/*
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.
83 */
84# define CAP_INIT_BSET CAP_FULL_SET
3b7391de 85
6b3ef48a 86#ifdef CONFIG_TREE_PREEMPT_RCU
a57eb940
PM
87#define INIT_TASK_RCU_TREE_PREEMPT() \
88 .rcu_blocked_node = NULL,
89#else
90#define INIT_TASK_RCU_TREE_PREEMPT(tsk)
91#endif
92#ifdef CONFIG_PREEMPT_RCU
f41d911f
PM
93#define INIT_TASK_RCU_PREEMPT(tsk) \
94 .rcu_read_lock_nesting = 0, \
95 .rcu_read_unlock_special = 0, \
a57eb940
PM
96 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
97 INIT_TASK_RCU_TREE_PREEMPT()
f41d911f
PM
98#else
99#define INIT_TASK_RCU_PREEMPT(tsk)
100#endif
101
b6dff3ec
DH
102extern struct cred init_cred;
103
cdd6c482
IM
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),
082ff5a2 109#else
cdd6c482 110# define INIT_PERF_EVENTS(tsk)
082ff5a2
PZ
111#endif
112
1da177e4
LT
113/*
114 * INIT_TASK is used to set up the first task table, touch at
115 * your own risk!. Base=0, limit=0x1fffff (=2MB)
116 */
117#define INIT_TASK(tsk) \
118{ \
119 .state = 0, \
f7e4217b 120 .stack = &init_thread_info, \
1da177e4 121 .usage = ATOMIC_INIT(2), \
7b34e428 122 .flags = PF_KTHREAD, \
1da177e4
LT
123 .lock_depth = -1, \
124 .prio = MAX_PRIO-20, \
125 .static_prio = MAX_PRIO-20, \
b29739f9 126 .normal_prio = MAX_PRIO-20, \
1da177e4
LT
127 .policy = SCHED_NORMAL, \
128 .cpus_allowed = CPU_MASK_ALL, \
129 .mm = NULL, \
130 .active_mm = &init_mm, \
4a55bd5e
PZ
131 .se = { \
132 .group_node = LIST_HEAD_INIT(tsk.se.group_node), \
133 }, \
fa717060
PZ
134 .rt = { \
135 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
6f505b16
PZ
136 .time_slice = HZ, \
137 .nr_cpus_allowed = NR_CPUS, \
138 }, \
1da177e4 139 .tasks = LIST_HEAD_INIT(tsk.tasks), \
917b627d 140 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
f470021a
RM
141 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
142 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
1da177e4
LT
143 .real_parent = &tsk, \
144 .parent = &tsk, \
145 .children = LIST_HEAD_INIT(tsk.children), \
146 .sibling = LIST_HEAD_INIT(tsk.sibling), \
147 .group_leader = &tsk, \
4d2deb40
AB
148 RCU_INIT_POINTER(.real_cred, &init_cred), \
149 RCU_INIT_POINTER(.cred, &init_cred), \
1da177e4
LT
150 .comm = "swapper", \
151 .thread = INIT_THREAD, \
152 .fs = &init_fs, \
153 .files = &init_files, \
154 .signal = &init_signals, \
155 .sighand = &init_sighand, \
ab516013 156 .nsproxy = &init_nsproxy, \
1da177e4
LT
157 .pending = { \
158 .list = LIST_HEAD_INIT(tsk.pending.list), \
159 .signal = {{0}}}, \
160 .blocked = {{0}}, \
e4d91918 161 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
b6e3224f 162 .journal_info = NULL, \
1da177e4 163 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
22e2c507 164 .fs_excl = ATOMIC_INIT(0), \
1d615482 165 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
6976675d 166 .timer_slack_ns = 50000, /* 50 usec default slack */ \
820e45db
SB
167 .pids = { \
168 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
169 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
170 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
171 }, \
fa2755e2 172 .thread_group = LIST_HEAD_INIT(tsk.thread_group), \
3e26c149 173 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
bfef93a5 174 INIT_IDS \
cdd6c482 175 INIT_PERF_EVENTS(tsk) \
de30a2b3 176 INIT_TRACE_IRQFLAGS \
fbb9ce95 177 INIT_LOCKDEP \
5ac9f622 178 INIT_FTRACE_GRAPH \
261842b7 179 INIT_TRACE_RECURSION \
f41d911f 180 INIT_TASK_RCU_PREEMPT(tsk) \
1da177e4
LT
181}
182
183
184#define INIT_CPU_TIMERS(cpu_timers) \
185{ \
186 LIST_HEAD_INIT(cpu_timers[0]), \
187 LIST_HEAD_INIT(cpu_timers[1]), \
188 LIST_HEAD_INIT(cpu_timers[2]), \
189}
190
857eceeb 191/* Attach to the init_task data structure for proper alignment */
2af7687f 192#define __init_task_data __attribute__((__section__(".data..init_task")))
857eceeb 193
1da177e4
LT
194
195#endif