]> git.karo-electronics.de Git - mv-sheeva.git/blob - include/linux/init_task.h
Merge branch 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[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_MM(name) \
19 {                                                               \
20         .mm_rb          = RB_ROOT,                              \
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,                         \
28 }
29
30 #define INIT_SIGNALS(sig) {                                             \
31         .count          = ATOMIC_INIT(1),                               \
32         .wait_chldexit  = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
33         .shared_pending = {                                             \
34                 .list = LIST_HEAD_INIT(sig.shared_pending.list),        \
35                 .signal =  {{0}}},                                      \
36         .posix_timers    = LIST_HEAD_INIT(sig.posix_timers),            \
37         .cpu_timers     = INIT_CPU_TIMERS(sig.cpu_timers),              \
38         .rlim           = INIT_RLIMITS,                                 \
39         .cputimer       = {                                             \
40                 .cputime = INIT_CPUTIME,                                \
41                 .running = 0,                                           \
42                 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock),        \
43         },                                                              \
44 }
45
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,                                 \
51         .mnt_ns         = NULL,                                         \
52         INIT_NET_NS(net_ns)                                             \
53         INIT_IPC_NS(ipc_ns)                                             \
54 }
55
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),  \
61 }
62
63 extern struct group_info init_groups;
64
65 #define INIT_STRUCT_PID {                                               \
66         .count          = ATOMIC_INIT(1),                               \
67         .tasks          = {                                             \
68                 { .first = &init_task.pids[PIDTYPE_PID].node },         \
69                 { .first = &init_task.pids[PIDTYPE_PGID].node },        \
70                 { .first = &init_task.pids[PIDTYPE_SID].node },         \
71         },                                                              \
72         .rcu            = RCU_HEAD_INIT,                                \
73         .level          = 0,                                            \
74         .numbers        = { {                                           \
75                 .nr             = 0,                                    \
76                 .ns             = &init_pid_ns,                         \
77                 .pid_chain      = { .next = NULL, .pprev = NULL },      \
78         }, }                                                            \
79 }
80
81 #define INIT_PID_LINK(type)                                     \
82 {                                                               \
83         .node = {                                               \
84                 .next = NULL,                                   \
85                 .pprev = &init_struct_pid.tasks[type].first,    \
86         },                                                      \
87         .pid = &init_struct_pid,                                \
88 }
89
90 #ifdef CONFIG_AUDITSYSCALL
91 #define INIT_IDS \
92         .loginuid = -1, \
93         .sessionid = -1,
94 #else
95 #define INIT_IDS
96 #endif
97
98 #ifdef CONFIG_SECURITY_FILE_CAPABILITIES
99 /*
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.
103  */
104 # define CAP_INIT_BSET  CAP_FULL_SET
105 #else
106 # define CAP_INIT_BSET  CAP_INIT_EFF_SET
107 #endif
108
109 extern struct cred init_cred;
110
111 /*
112  *  INIT_TASK is used to set up the first task table, touch at
113  * your own risk!. Base=0, limit=0x1fffff (=2MB)
114  */
115 #define INIT_TASK(tsk)  \
116 {                                                                       \
117         .state          = 0,                                            \
118         .stack          = &init_thread_info,                            \
119         .usage          = ATOMIC_INIT(2),                               \
120         .flags          = PF_KTHREAD,                                   \
121         .lock_depth     = -1,                                           \
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,                                 \
127         .mm             = NULL,                                         \
128         .active_mm      = &init_mm,                                     \
129         .se             = {                                             \
130                 .group_node     = LIST_HEAD_INIT(tsk.se.group_node),    \
131         },                                                              \
132         .rt             = {                                             \
133                 .run_list       = LIST_HEAD_INIT(tsk.rt.run_list),      \
134                 .time_slice     = HZ,                                   \
135                 .nr_cpus_allowed = NR_CPUS,                             \
136         },                                                              \
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,                                         \
142         .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_exec_mutex =                                              \
149                  __MUTEX_INITIALIZER(tsk.cred_exec_mutex),              \
150         .comm           = "swapper",                                    \
151         .thread         = INIT_THREAD,                                  \
152         .fs             = &init_fs,                                     \
153         .files          = &init_files,                                  \
154         .signal         = &init_signals,                                \
155         .sighand        = &init_sighand,                                \
156         .nsproxy        = &init_nsproxy,                                \
157         .pending        = {                                             \
158                 .list = LIST_HEAD_INIT(tsk.pending.list),               \
159                 .signal = {{0}}},                                       \
160         .blocked        = {{0}},                                        \
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 */            \
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         },                                                              \
172         .dirties = INIT_PROP_LOCAL_SINGLE(dirties),                     \
173         INIT_IDS                                                        \
174         INIT_TRACE_IRQFLAGS                                             \
175         INIT_LOCKDEP                                                    \
176         INIT_FTRACE_GRAPH                                               \
177 }
178
179
180 #define INIT_CPU_TIMERS(cpu_timers)                                     \
181 {                                                                       \
182         LIST_HEAD_INIT(cpu_timers[0]),                                  \
183         LIST_HEAD_INIT(cpu_timers[1]),                                  \
184         LIST_HEAD_INIT(cpu_timers[2]),                                  \
185 }
186
187
188 #endif