Don't include linux/config.h from anywhere else in include/
[linux-2.6.git] / include / linux / init_task.h
1 #ifndef _LINUX__INIT_TASK_H
2 #define _LINUX__INIT_TASK_H
3
4 #include <linux/file.h>
5 #include <linux/rcupdate.h>
6
7 #define INIT_FDTABLE \
8 {                                                       \
9         .max_fds        = NR_OPEN_DEFAULT,              \
10         .max_fdset      = EMBEDDED_FD_SET_SIZE,         \
11         .fd             = &init_files.fd_array[0],      \
12         .close_on_exec  = (fd_set *)&init_files.close_on_exec_init, \
13         .open_fds       = (fd_set *)&init_files.open_fds_init,  \
14         .rcu            = RCU_HEAD_INIT,                \
15         .free_files     = NULL,                         \
16         .next           = NULL,                         \
17 }
18
19 #define INIT_FILES \
20 {                                                       \
21         .count          = ATOMIC_INIT(1),               \
22         .fdt            = &init_files.fdtab,            \
23         .fdtab          = INIT_FDTABLE,                 \
24         .file_lock      = SPIN_LOCK_UNLOCKED,           \
25         .next_fd        = 0,                            \
26         .close_on_exec_init = { { 0, } },               \
27         .open_fds_init  = { { 0, } },                   \
28         .fd_array       = { NULL, }                     \
29 }
30
31 #define INIT_KIOCTX(name, which_mm) \
32 {                                                       \
33         .users          = ATOMIC_INIT(1),               \
34         .dead           = 0,                            \
35         .mm             = &which_mm,                    \
36         .user_id        = 0,                            \
37         .next           = NULL,                         \
38         .wait           = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \
39         .ctx_lock       = SPIN_LOCK_UNLOCKED,           \
40         .reqs_active    = 0U,                           \
41         .max_reqs       = ~0U,                          \
42 }
43
44 #define INIT_MM(name) \
45 {                                                               \
46         .mm_rb          = RB_ROOT,                              \
47         .pgd            = swapper_pg_dir,                       \
48         .mm_users       = ATOMIC_INIT(2),                       \
49         .mm_count       = ATOMIC_INIT(1),                       \
50         .mmap_sem       = __RWSEM_INITIALIZER(name.mmap_sem),   \
51         .page_table_lock =  SPIN_LOCK_UNLOCKED,                 \
52         .mmlist         = LIST_HEAD_INIT(name.mmlist),          \
53         .cpu_vm_mask    = CPU_MASK_ALL,                         \
54 }
55
56 #define INIT_SIGNALS(sig) {     \
57         .count          = ATOMIC_INIT(1),               \
58         .wait_chldexit  = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
59         .shared_pending = {                             \
60                 .list = LIST_HEAD_INIT(sig.shared_pending.list),        \
61                 .signal =  {{0}}}, \
62         .posix_timers    = LIST_HEAD_INIT(sig.posix_timers),            \
63         .cpu_timers     = INIT_CPU_TIMERS(sig.cpu_timers),              \
64         .rlim           = INIT_RLIMITS,                                 \
65         .pgrp           = 1,                                            \
66         .session        = 1,                                            \
67 }
68
69 #define INIT_SIGHAND(sighand) {                                         \
70         .count          = ATOMIC_INIT(1),                               \
71         .action         = { { { .sa_handler = NULL, } }, },             \
72         .siglock        = SPIN_LOCK_UNLOCKED,                           \
73 }
74
75 extern struct group_info init_groups;
76
77 /*
78  *  INIT_TASK is used to set up the first task table, touch at
79  * your own risk!. Base=0, limit=0x1fffff (=2MB)
80  */
81 #define INIT_TASK(tsk)  \
82 {                                                                       \
83         .state          = 0,                                            \
84         .thread_info    = &init_thread_info,                            \
85         .usage          = ATOMIC_INIT(2),                               \
86         .flags          = 0,                                            \
87         .lock_depth     = -1,                                           \
88         .prio           = MAX_PRIO-20,                                  \
89         .static_prio    = MAX_PRIO-20,                                  \
90         .policy         = SCHED_NORMAL,                                 \
91         .cpus_allowed   = CPU_MASK_ALL,                                 \
92         .mm             = NULL,                                         \
93         .active_mm      = &init_mm,                                     \
94         .run_list       = LIST_HEAD_INIT(tsk.run_list),                 \
95         .ioprio         = 0,                                            \
96         .time_slice     = HZ,                                           \
97         .tasks          = LIST_HEAD_INIT(tsk.tasks),                    \
98         .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children),          \
99         .ptrace_list    = LIST_HEAD_INIT(tsk.ptrace_list),              \
100         .real_parent    = &tsk,                                         \
101         .parent         = &tsk,                                         \
102         .children       = LIST_HEAD_INIT(tsk.children),                 \
103         .sibling        = LIST_HEAD_INIT(tsk.sibling),                  \
104         .group_leader   = &tsk,                                         \
105         .group_info     = &init_groups,                                 \
106         .cap_effective  = CAP_INIT_EFF_SET,                             \
107         .cap_inheritable = CAP_INIT_INH_SET,                            \
108         .cap_permitted  = CAP_FULL_SET,                                 \
109         .keep_capabilities = 0,                                         \
110         .user           = INIT_USER,                                    \
111         .comm           = "swapper",                                    \
112         .thread         = INIT_THREAD,                                  \
113         .fs             = &init_fs,                                     \
114         .files          = &init_files,                                  \
115         .signal         = &init_signals,                                \
116         .sighand        = &init_sighand,                                \
117         .pending        = {                                             \
118                 .list = LIST_HEAD_INIT(tsk.pending.list),               \
119                 .signal = {{0}}},                                       \
120         .blocked        = {{0}},                                        \
121         .alloc_lock     = SPIN_LOCK_UNLOCKED,                           \
122         .proc_lock      = SPIN_LOCK_UNLOCKED,                           \
123         .journal_info   = NULL,                                         \
124         .cpu_timers     = INIT_CPU_TIMERS(tsk.cpu_timers),              \
125         .fs_excl        = ATOMIC_INIT(0),                               \
126 }
127
128
129 #define INIT_CPU_TIMERS(cpu_timers)                                     \
130 {                                                                       \
131         LIST_HEAD_INIT(cpu_timers[0]),                                  \
132         LIST_HEAD_INIT(cpu_timers[1]),                                  \
133         LIST_HEAD_INIT(cpu_timers[2]),                                  \
134 }
135
136
137 #endif