]> git.karo-electronics.de Git - mv-sheeva.git/blob - include/linux/init_task.h
f00253b3fc47b78d14c925d2e350312653577d90
[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         .count          = ATOMIC_INIT(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 }
33
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,                                 \
39         .mnt_ns         = NULL,                                         \
40         INIT_NET_NS(net_ns)                                             \
41         INIT_IPC_NS(ipc_ns)                                             \
42 }
43
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),  \
49 }
50
51 extern struct group_info init_groups;
52
53 #define INIT_STRUCT_PID {                                               \
54         .count          = ATOMIC_INIT(1),                               \
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,                                \
61         .level          = 0,                                            \
62         .numbers        = { {                                           \
63                 .nr             = 0,                                    \
64                 .ns             = &init_pid_ns,                         \
65                 .pid_chain      = { .next = NULL, .pprev = NULL },      \
66         }, }                                                            \
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
78 #ifdef CONFIG_AUDITSYSCALL
79 #define INIT_IDS \
80         .loginuid = -1, \
81         .sessionid = -1,
82 #else
83 #define INIT_IDS
84 #endif
85
86 /*
87  * Because of the reduced scope of CAP_SETPCAP when filesystem
88  * capabilities are in effect, it is safe to allow CAP_SETPCAP to
89  * be available in the default configuration.
90  */
91 # define CAP_INIT_BSET  CAP_FULL_SET
92
93 #ifdef CONFIG_TREE_PREEMPT_RCU
94 #define INIT_TASK_RCU_PREEMPT(tsk)                                      \
95         .rcu_read_lock_nesting = 0,                                     \
96         .rcu_read_unlock_special = 0,                                   \
97         .rcu_blocked_node = NULL,                                       \
98         .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry),
99 #else
100 #define INIT_TASK_RCU_PREEMPT(tsk)
101 #endif
102
103 extern struct cred init_cred;
104
105 #ifdef CONFIG_PERF_EVENTS
106 # define INIT_PERF_EVENTS(tsk)                                  \
107         .perf_event_mutex =                                             \
108                  __MUTEX_INITIALIZER(tsk.perf_event_mutex),             \
109         .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
110 #else
111 # define INIT_PERF_EVENTS(tsk)
112 #endif
113
114 /*
115  *  INIT_TASK is used to set up the first task table, touch at
116  * your own risk!. Base=0, limit=0x1fffff (=2MB)
117  */
118 #define INIT_TASK(tsk)  \
119 {                                                                       \
120         .state          = 0,                                            \
121         .stack          = &init_thread_info,                            \
122         .usage          = ATOMIC_INIT(2),                               \
123         .flags          = PF_KTHREAD,                                   \
124         .lock_depth     = -1,                                           \
125         .prio           = MAX_PRIO-20,                                  \
126         .static_prio    = MAX_PRIO-20,                                  \
127         .normal_prio    = MAX_PRIO-20,                                  \
128         .policy         = SCHED_NORMAL,                                 \
129         .cpus_allowed   = CPU_MASK_ALL,                                 \
130         .mm             = NULL,                                         \
131         .active_mm      = &init_mm,                                     \
132         .se             = {                                             \
133                 .group_node     = LIST_HEAD_INIT(tsk.se.group_node),    \
134         },                                                              \
135         .rt             = {                                             \
136                 .run_list       = LIST_HEAD_INIT(tsk.rt.run_list),      \
137                 .time_slice     = HZ,                                   \
138                 .nr_cpus_allowed = NR_CPUS,                             \
139         },                                                              \
140         .tasks          = LIST_HEAD_INIT(tsk.tasks),                    \
141         .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
142         .ptraced        = LIST_HEAD_INIT(tsk.ptraced),                  \
143         .ptrace_entry   = LIST_HEAD_INIT(tsk.ptrace_entry),             \
144         .real_parent    = &tsk,                                         \
145         .parent         = &tsk,                                         \
146         .children       = LIST_HEAD_INIT(tsk.children),                 \
147         .sibling        = LIST_HEAD_INIT(tsk.sibling),                  \
148         .group_leader   = &tsk,                                         \
149         .real_cred      = &init_cred,                                   \
150         .cred           = &init_cred,                                   \
151         .cred_guard_mutex =                                             \
152                  __MUTEX_INITIALIZER(tsk.cred_guard_mutex),             \
153         .comm           = "swapper",                                    \
154         .thread         = INIT_THREAD,                                  \
155         .fs             = &init_fs,                                     \
156         .files          = &init_files,                                  \
157         .signal         = &init_signals,                                \
158         .sighand        = &init_sighand,                                \
159         .nsproxy        = &init_nsproxy,                                \
160         .pending        = {                                             \
161                 .list = LIST_HEAD_INIT(tsk.pending.list),               \
162                 .signal = {{0}}},                                       \
163         .blocked        = {{0}},                                        \
164         .alloc_lock     = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock),         \
165         .journal_info   = NULL,                                         \
166         .cpu_timers     = INIT_CPU_TIMERS(tsk.cpu_timers),              \
167         .fs_excl        = ATOMIC_INIT(0),                               \
168         .pi_lock        = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock),        \
169         .timer_slack_ns = 50000, /* 50 usec default slack */            \
170         .pids = {                                                       \
171                 [PIDTYPE_PID]  = INIT_PID_LINK(PIDTYPE_PID),            \
172                 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID),           \
173                 [PIDTYPE_SID]  = INIT_PID_LINK(PIDTYPE_SID),            \
174         },                                                              \
175         .dirties = INIT_PROP_LOCAL_SINGLE(dirties),                     \
176         INIT_IDS                                                        \
177         INIT_PERF_EVENTS(tsk)                                           \
178         INIT_TRACE_IRQFLAGS                                             \
179         INIT_LOCKDEP                                                    \
180         INIT_FTRACE_GRAPH                                               \
181         INIT_TRACE_RECURSION                                            \
182         INIT_TASK_RCU_PREEMPT(tsk)                                      \
183 }
184
185
186 #define INIT_CPU_TIMERS(cpu_timers)                                     \
187 {                                                                       \
188         LIST_HEAD_INIT(cpu_timers[0]),                                  \
189         LIST_HEAD_INIT(cpu_timers[1]),                                  \
190         LIST_HEAD_INIT(cpu_timers[2]),                                  \
191 }
192
193 /* Attach to the init_task data structure for proper alignment */
194 #define __init_task_data __attribute__((__section__(".data..init_task")))
195
196
197 #endif