perf_counter: Rename 'event' to event_id/hw_event
[GitHub/mt8127/android_kernel_alcatel_ttab.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
CLG
18#define INIT_SIGNALS(sig) { \
19 .count = ATOMIC_INIT(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 }, \
1da177e4
LT
32}
33
ab516013
SH
34extern struct nsproxy init_nsproxy;
35#define INIT_NSPROXY(nsproxy) { \
9a575a92 36 .pid_ns = &init_pid_ns, \
ab516013 37 .count = ATOMIC_INIT(1), \
4865ecf1 38 .uts_ns = &init_uts_ns, \
6b3286ed 39 .mnt_ns = NULL, \
4fabcd71 40 INIT_NET_NS(net_ns) \
73ea4130 41 INIT_IPC_NS(ipc_ns) \
ab516013
SH
42}
43
1da177e4
LT
44#define INIT_SIGHAND(sighand) { \
45 .count = ATOMIC_INIT(1), \
46 .action = { { { .sa_handler = NULL, } }, }, \
e4d91918 47 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
b8fceee1 48 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
1da177e4
LT
49}
50
51extern struct group_info init_groups;
52
820e45db
SB
53#define INIT_STRUCT_PID { \
54 .count = ATOMIC_INIT(1), \
820e45db
SB
55 .tasks = { \
56 { .first = &init_task.pids[PIDTYPE_PID].node }, \
57 { .first = &init_task.pids[PIDTYPE_PGID].node }, \
58 { .first = &init_task.pids[PIDTYPE_SID].node }, \
59 }, \
60 .rcu = RCU_HEAD_INIT, \
4c3f2ead
SB
61 .level = 0, \
62 .numbers = { { \
63 .nr = 0, \
64 .ns = &init_pid_ns, \
65 .pid_chain = { .next = NULL, .pprev = NULL }, \
66 }, } \
820e45db
SB
67}
68
69#define INIT_PID_LINK(type) \
70{ \
71 .node = { \
72 .next = NULL, \
73 .pprev = &init_struct_pid.tasks[type].first, \
74 }, \
75 .pid = &init_struct_pid, \
76}
77
bfef93a5
AV
78#ifdef CONFIG_AUDITSYSCALL
79#define INIT_IDS \
4746ec5b
EP
80 .loginuid = -1, \
81 .sessionid = -1,
bfef93a5
AV
82#else
83#define INIT_IDS
84#endif
3b7391de
SH
85
86#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
87/*
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.
91 */
92# define CAP_INIT_BSET CAP_FULL_SET
93#else
94# define CAP_INIT_BSET CAP_INIT_EFF_SET
95#endif
96
6b3ef48a 97#ifdef CONFIG_TREE_PREEMPT_RCU
f41d911f
PM
98#define INIT_TASK_RCU_PREEMPT(tsk) \
99 .rcu_read_lock_nesting = 0, \
100 .rcu_read_unlock_special = 0, \
dd5d19ba 101 .rcu_blocked_node = NULL, \
f41d911f
PM
102 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry),
103#else
104#define INIT_TASK_RCU_PREEMPT(tsk)
105#endif
106
b6dff3ec
DH
107extern struct cred init_cred;
108
082ff5a2
PZ
109#ifdef CONFIG_PERF_COUNTERS
110# define INIT_PERF_COUNTERS(tsk) \
111 .perf_counter_mutex = \
112 __MUTEX_INITIALIZER(tsk.perf_counter_mutex), \
113 .perf_counter_list = LIST_HEAD_INIT(tsk.perf_counter_list),
114#else
115# define INIT_PERF_COUNTERS(tsk)
116#endif
117
1da177e4
LT
118/*
119 * INIT_TASK is used to set up the first task table, touch at
120 * your own risk!. Base=0, limit=0x1fffff (=2MB)
121 */
122#define INIT_TASK(tsk) \
123{ \
124 .state = 0, \
f7e4217b 125 .stack = &init_thread_info, \
1da177e4 126 .usage = ATOMIC_INIT(2), \
7b34e428 127 .flags = PF_KTHREAD, \
1da177e4
LT
128 .lock_depth = -1, \
129 .prio = MAX_PRIO-20, \
130 .static_prio = MAX_PRIO-20, \
b29739f9 131 .normal_prio = MAX_PRIO-20, \
1da177e4
LT
132 .policy = SCHED_NORMAL, \
133 .cpus_allowed = CPU_MASK_ALL, \
134 .mm = NULL, \
135 .active_mm = &init_mm, \
4a55bd5e
PZ
136 .se = { \
137 .group_node = LIST_HEAD_INIT(tsk.se.group_node), \
138 }, \
fa717060
PZ
139 .rt = { \
140 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
6f505b16
PZ
141 .time_slice = HZ, \
142 .nr_cpus_allowed = NR_CPUS, \
143 }, \
1da177e4 144 .tasks = LIST_HEAD_INIT(tsk.tasks), \
917b627d 145 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
f470021a
RM
146 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
147 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
1da177e4
LT
148 .real_parent = &tsk, \
149 .parent = &tsk, \
150 .children = LIST_HEAD_INIT(tsk.children), \
151 .sibling = LIST_HEAD_INIT(tsk.sibling), \
152 .group_leader = &tsk, \
3b11a1de 153 .real_cred = &init_cred, \
f1752eec 154 .cred = &init_cred, \
5e751e99
DH
155 .cred_guard_mutex = \
156 __MUTEX_INITIALIZER(tsk.cred_guard_mutex), \
1da177e4
LT
157 .comm = "swapper", \
158 .thread = INIT_THREAD, \
159 .fs = &init_fs, \
160 .files = &init_files, \
161 .signal = &init_signals, \
162 .sighand = &init_sighand, \
ab516013 163 .nsproxy = &init_nsproxy, \
1da177e4
LT
164 .pending = { \
165 .list = LIST_HEAD_INIT(tsk.pending.list), \
166 .signal = {{0}}}, \
167 .blocked = {{0}}, \
e4d91918 168 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
1da177e4
LT
169 .journal_info = NULL, \
170 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
22e2c507 171 .fs_excl = ATOMIC_INIT(0), \
b32e41bb 172 .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
6976675d 173 .timer_slack_ns = 50000, /* 50 usec default slack */ \
820e45db
SB
174 .pids = { \
175 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
176 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
177 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
178 }, \
3e26c149 179 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
bfef93a5 180 INIT_IDS \
082ff5a2 181 INIT_PERF_COUNTERS(tsk) \
de30a2b3 182 INIT_TRACE_IRQFLAGS \
fbb9ce95 183 INIT_LOCKDEP \
5ac9f622 184 INIT_FTRACE_GRAPH \
261842b7 185 INIT_TRACE_RECURSION \
f41d911f 186 INIT_TASK_RCU_PREEMPT(tsk) \
1da177e4
LT
187}
188
189
190#define INIT_CPU_TIMERS(cpu_timers) \
191{ \
192 LIST_HEAD_INIT(cpu_timers[0]), \
193 LIST_HEAD_INIT(cpu_timers[1]), \
194 LIST_HEAD_INIT(cpu_timers[2]), \
195}
196
857eceeb
TA
197/* Attach to the init_task data structure for proper alignment */
198#define __init_task_data __attribute__((__section__(".data.init_task")))
199
1da177e4
LT
200
201#endif