]> git.karo-electronics.de Git - mv-sheeva.git/blob - include/linux/init_task.h
Merge branch 'rcu/next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck...
[mv-sheeva.git] / include / linux / init_task.h
1 #ifndef _LINUX__INIT_TASK_H
2 #define _LINUX__INIT_TASK_H
3
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>
9 #include <linux/ipc.h>
10 #include <linux/pid_namespace.h>
11 #include <linux/user_namespace.h>
12 #include <linux/securebits.h>
13 #include <net/net_namespace.h>
14
15 extern struct files_struct init_files;
16 extern struct fs_struct init_fs;
17
18 #define INIT_SIGNALS(sig) {                                             \
19         .nr_threads     = 1,                                            \
20         .wait_chldexit  = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
21         .shared_pending = {                                             \
22                 .list = LIST_HEAD_INIT(sig.shared_pending.list),        \
23                 .signal =  {{0}}},                                      \
24         .posix_timers    = LIST_HEAD_INIT(sig.posix_timers),            \
25         .cpu_timers     = INIT_CPU_TIMERS(sig.cpu_timers),              \
26         .rlim           = INIT_RLIMITS,                                 \
27         .cputimer       = {                                             \
28                 .cputime = INIT_CPUTIME,                                \
29                 .running = 0,                                           \
30                 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock),        \
31         },                                                              \
32         .cred_guard_mutex =                                             \
33                  __MUTEX_INITIALIZER(sig.cred_guard_mutex),             \
34 }
35
36 extern struct nsproxy init_nsproxy;
37
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),  \
43 }
44
45 extern struct group_info init_groups;
46
47 #define INIT_STRUCT_PID {                                               \
48         .count          = ATOMIC_INIT(1),                               \
49         .tasks          = {                                             \
50                 { .first = NULL },                                      \
51                 { .first = NULL },                                      \
52                 { .first = NULL },                                      \
53         },                                                              \
54         .level          = 0,                                            \
55         .numbers        = { {                                           \
56                 .nr             = 0,                                    \
57                 .ns             = &init_pid_ns,                         \
58                 .pid_chain      = { .next = NULL, .pprev = NULL },      \
59         }, }                                                            \
60 }
61
62 #define INIT_PID_LINK(type)                                     \
63 {                                                               \
64         .node = {                                               \
65                 .next = NULL,                                   \
66                 .pprev = NULL,                                  \
67         },                                                      \
68         .pid = &init_struct_pid,                                \
69 }
70
71 #ifdef CONFIG_AUDITSYSCALL
72 #define INIT_IDS \
73         .loginuid = -1, \
74         .sessionid = -1,
75 #else
76 #define INIT_IDS
77 #endif
78
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
85
86 #ifdef CONFIG_RCU_BOOST
87 #define INIT_TASK_RCU_BOOST()                                           \
88         .rcu_boost_mutex = NULL,
89 #else
90 #define INIT_TASK_RCU_BOOST()
91 #endif
92 #ifdef CONFIG_TREE_PREEMPT_RCU
93 #define INIT_TASK_RCU_TREE_PREEMPT()                                    \
94         .rcu_blocked_node = NULL,
95 #else
96 #define INIT_TASK_RCU_TREE_PREEMPT(tsk)
97 #endif
98 #ifdef CONFIG_PREEMPT_RCU
99 #define INIT_TASK_RCU_PREEMPT(tsk)                                      \
100         .rcu_read_lock_nesting = 0,                                     \
101         .rcu_read_unlock_special = 0,                                   \
102         .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry),           \
103         INIT_TASK_RCU_TREE_PREEMPT()                                    \
104         INIT_TASK_RCU_BOOST()
105 #else
106 #define INIT_TASK_RCU_PREEMPT(tsk)
107 #endif
108
109 extern struct cred init_cred;
110
111 #ifdef CONFIG_PERF_EVENTS
112 # define INIT_PERF_EVENTS(tsk)                                  \
113         .perf_event_mutex =                                             \
114                  __MUTEX_INITIALIZER(tsk.perf_event_mutex),             \
115         .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
116 #else
117 # define INIT_PERF_EVENTS(tsk)
118 #endif
119
120 /*
121  *  INIT_TASK is used to set up the first task table, touch at
122  * your own risk!. Base=0, limit=0x1fffff (=2MB)
123  */
124 #define INIT_TASK(tsk)  \
125 {                                                                       \
126         .state          = 0,                                            \
127         .stack          = &init_thread_info,                            \
128         .usage          = ATOMIC_INIT(2),                               \
129         .flags          = PF_KTHREAD,                                   \
130         .lock_depth     = -1,                                           \
131         .prio           = MAX_PRIO-20,                                  \
132         .static_prio    = MAX_PRIO-20,                                  \
133         .normal_prio    = MAX_PRIO-20,                                  \
134         .policy         = SCHED_NORMAL,                                 \
135         .cpus_allowed   = CPU_MASK_ALL,                                 \
136         .mm             = NULL,                                         \
137         .active_mm      = &init_mm,                                     \
138         .se             = {                                             \
139                 .group_node     = LIST_HEAD_INIT(tsk.se.group_node),    \
140         },                                                              \
141         .rt             = {                                             \
142                 .run_list       = LIST_HEAD_INIT(tsk.rt.run_list),      \
143                 .time_slice     = HZ,                                   \
144                 .nr_cpus_allowed = NR_CPUS,                             \
145         },                                                              \
146         .tasks          = LIST_HEAD_INIT(tsk.tasks),                    \
147         .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
148         .ptraced        = LIST_HEAD_INIT(tsk.ptraced),                  \
149         .ptrace_entry   = LIST_HEAD_INIT(tsk.ptrace_entry),             \
150         .real_parent    = &tsk,                                         \
151         .parent         = &tsk,                                         \
152         .children       = LIST_HEAD_INIT(tsk.children),                 \
153         .sibling        = LIST_HEAD_INIT(tsk.sibling),                  \
154         .group_leader   = &tsk,                                         \
155         RCU_INIT_POINTER(.real_cred, &init_cred),                       \
156         RCU_INIT_POINTER(.cred, &init_cred),                            \
157         .comm           = "swapper",                                    \
158         .thread         = INIT_THREAD,                                  \
159         .fs             = &init_fs,                                     \
160         .files          = &init_files,                                  \
161         .signal         = &init_signals,                                \
162         .sighand        = &init_sighand,                                \
163         .nsproxy        = &init_nsproxy,                                \
164         .pending        = {                                             \
165                 .list = LIST_HEAD_INIT(tsk.pending.list),               \
166                 .signal = {{0}}},                                       \
167         .blocked        = {{0}},                                        \
168         .alloc_lock     = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock),         \
169         .journal_info   = NULL,                                         \
170         .cpu_timers     = INIT_CPU_TIMERS(tsk.cpu_timers),              \
171         .fs_excl        = ATOMIC_INIT(0),                               \
172         .pi_lock        = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock),        \
173         .timer_slack_ns = 50000, /* 50 usec default slack */            \
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         },                                                              \
179         .thread_group   = LIST_HEAD_INIT(tsk.thread_group),             \
180         .dirties = INIT_PROP_LOCAL_SINGLE(dirties),                     \
181         INIT_IDS                                                        \
182         INIT_PERF_EVENTS(tsk)                                           \
183         INIT_TRACE_IRQFLAGS                                             \
184         INIT_LOCKDEP                                                    \
185         INIT_FTRACE_GRAPH                                               \
186         INIT_TRACE_RECURSION                                            \
187         INIT_TASK_RCU_PREEMPT(tsk)                                      \
188 }
189
190
191 #define INIT_CPU_TIMERS(cpu_timers)                                     \
192 {                                                                       \
193         LIST_HEAD_INIT(cpu_timers[0]),                                  \
194         LIST_HEAD_INIT(cpu_timers[1]),                                  \
195         LIST_HEAD_INIT(cpu_timers[2]),                                  \
196 }
197
198 /* Attach to the init_task data structure for proper alignment */
199 #define __init_task_data __attribute__((__section__(".data..init_task")))
200
201
202 #endif