[PATCH] timer-irq-driven soft-watchdog, cleanups
[linux-2.6] / 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 }
66
67 #define INIT_SIGHAND(sighand) {                                         \
68         .count          = ATOMIC_INIT(1),                               \
69         .action         = { { { .sa_handler = NULL, } }, },             \
70         .siglock        = SPIN_LOCK_UNLOCKED,                           \
71 }
72
73 extern struct group_info init_groups;
74
75 /*
76  *  INIT_TASK is used to set up the first task table, touch at
77  * your own risk!. Base=0, limit=0x1fffff (=2MB)
78  */
79 #define INIT_TASK(tsk)  \
80 {                                                                       \
81         .state          = 0,                                            \
82         .thread_info    = &init_thread_info,                            \
83         .usage          = ATOMIC_INIT(2),                               \
84         .flags          = 0,                                            \
85         .lock_depth     = -1,                                           \
86         .prio           = MAX_PRIO-20,                                  \
87         .static_prio    = MAX_PRIO-20,                                  \
88         .policy         = SCHED_NORMAL,                                 \
89         .cpus_allowed   = CPU_MASK_ALL,                                 \
90         .mm             = NULL,                                         \
91         .active_mm      = &init_mm,                                     \
92         .run_list       = LIST_HEAD_INIT(tsk.run_list),                 \
93         .ioprio         = 0,                                            \
94         .time_slice     = HZ,                                           \
95         .tasks          = LIST_HEAD_INIT(tsk.tasks),                    \
96         .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children),          \
97         .ptrace_list    = LIST_HEAD_INIT(tsk.ptrace_list),              \
98         .real_parent    = &tsk,                                         \
99         .parent         = &tsk,                                         \
100         .children       = LIST_HEAD_INIT(tsk.children),                 \
101         .sibling        = LIST_HEAD_INIT(tsk.sibling),                  \
102         .group_leader   = &tsk,                                         \
103         .group_info     = &init_groups,                                 \
104         .cap_effective  = CAP_INIT_EFF_SET,                             \
105         .cap_inheritable = CAP_INIT_INH_SET,                            \
106         .cap_permitted  = CAP_FULL_SET,                                 \
107         .keep_capabilities = 0,                                         \
108         .user           = INIT_USER,                                    \
109         .comm           = "swapper",                                    \
110         .thread         = INIT_THREAD,                                  \
111         .fs             = &init_fs,                                     \
112         .files          = &init_files,                                  \
113         .signal         = &init_signals,                                \
114         .sighand        = &init_sighand,                                \
115         .pending        = {                                             \
116                 .list = LIST_HEAD_INIT(tsk.pending.list),               \
117                 .signal = {{0}}},                                       \
118         .blocked        = {{0}},                                        \
119         .alloc_lock     = SPIN_LOCK_UNLOCKED,                           \
120         .proc_lock      = SPIN_LOCK_UNLOCKED,                           \
121         .journal_info   = NULL,                                         \
122         .cpu_timers     = INIT_CPU_TIMERS(tsk.cpu_timers),              \
123         .fs_excl        = ATOMIC_INIT(0),                               \
124 }
125
126
127 #define INIT_CPU_TIMERS(cpu_timers)                                     \
128 {                                                                       \
129         LIST_HEAD_INIT(cpu_timers[0]),                                  \
130         LIST_HEAD_INIT(cpu_timers[1]),                                  \
131         LIST_HEAD_INIT(cpu_timers[2]),                                  \
132 }
133
134
135 #endif