Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef _LINUX__INIT_TASK_H |
3 | #define _LINUX__INIT_TASK_H | |
4 | ||
ab2af1f5 | 5 | #include <linux/rcupdate.h> |
de30a2b3 | 6 | #include <linux/irqflags.h> |
4865ecf1 | 7 | #include <linux/utsname.h> |
fbb9ce95 | 8 | #include <linux/lockdep.h> |
5ac9f622 | 9 | #include <linux/ftrace.h> |
73ea4130 | 10 | #include <linux/ipc.h> |
9a575a92 | 11 | #include <linux/pid_namespace.h> |
acce292c | 12 | #include <linux/user_namespace.h> |
3898b1b4 | 13 | #include <linux/securebits.h> |
6a61671b | 14 | #include <linux/seqlock.h> |
fb00aca4 | 15 | #include <linux/rbtree.h> |
dfc3401a | 16 | #include <linux/sched/autogroup.h> |
772698f6 | 17 | #include <net/net_namespace.h> |
77852fea | 18 | #include <linux/sched/rt.h> |
d83a7cb3 | 19 | #include <linux/livepatch.h> |
589ee628 | 20 | #include <linux/mm_types.h> |
1da177e4 | 21 | |
c65eacbe AL |
22 | #include <asm/thread_info.h> |
23 | ||
f52111b1 | 24 | extern struct files_struct init_files; |
18d8fda7 | 25 | extern struct fs_struct init_fs; |
1da177e4 | 26 | |
9d7fb042 PZ |
27 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE |
28 | #define INIT_PREV_CPUTIME(x) .prev_cputime = { \ | |
29 | .lock = __RAW_SPIN_LOCK_UNLOCKED(x.prev_cputime.lock), \ | |
30 | }, | |
31 | #else | |
32 | #define INIT_PREV_CPUTIME(x) | |
33 | #endif | |
34 | ||
b18b6a9c NP |
35 | #ifdef CONFIG_POSIX_TIMERS |
36 | #define INIT_POSIX_TIMERS(s) \ | |
37 | .posix_timers = LIST_HEAD_INIT(s.posix_timers), | |
38 | #define INIT_CPU_TIMERS(s) \ | |
39 | .cpu_timers = { \ | |
40 | LIST_HEAD_INIT(s.cpu_timers[0]), \ | |
41 | LIST_HEAD_INIT(s.cpu_timers[1]), \ | |
42 | LIST_HEAD_INIT(s.cpu_timers[2]), \ | |
43 | }, | |
44 | #define INIT_CPUTIMER(s) \ | |
45 | .cputimer = { \ | |
46 | .cputime_atomic = INIT_CPUTIME_ATOMIC, \ | |
47 | .running = false, \ | |
48 | .checking_timer = false, \ | |
49 | }, | |
50 | #else | |
51 | #define INIT_POSIX_TIMERS(s) | |
52 | #define INIT_CPU_TIMERS(s) | |
53 | #define INIT_CPUTIMER(s) | |
54 | #endif | |
55 | ||
1ec320af | 56 | #define INIT_SIGNALS(sig) { \ |
b3ac022c | 57 | .nr_threads = 1, \ |
0c740d0a | 58 | .thread_head = LIST_HEAD_INIT(init_task.thread_node), \ |
1da177e4 | 59 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ |
1ec320af | 60 | .shared_pending = { \ |
1da177e4 | 61 | .list = LIST_HEAD_INIT(sig.shared_pending.list), \ |
1ec320af | 62 | .signal = {{0}}}, \ |
b18b6a9c NP |
63 | INIT_POSIX_TIMERS(sig) \ |
64 | INIT_CPU_TIMERS(sig) \ | |
1da177e4 | 65 | .rlim = INIT_RLIMITS, \ |
b18b6a9c | 66 | INIT_CPUTIMER(sig) \ |
9d7fb042 | 67 | INIT_PREV_CPUTIME(sig) \ |
9b1bf12d KM |
68 | .cred_guard_mutex = \ |
69 | __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ | |
1da177e4 LT |
70 | } |
71 | ||
ab516013 | 72 | extern struct nsproxy init_nsproxy; |
ab516013 | 73 | |
1da177e4 LT |
74 | #define INIT_SIGHAND(sighand) { \ |
75 | .count = ATOMIC_INIT(1), \ | |
0a14a130 | 76 | .action = { { { .sa_handler = SIG_DFL, } }, }, \ |
e4d91918 | 77 | .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \ |
b8fceee1 | 78 | .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \ |
1da177e4 LT |
79 | } |
80 | ||
81 | extern struct group_info init_groups; | |
82 | ||
820e45db SB |
83 | #define INIT_STRUCT_PID { \ |
84 | .count = ATOMIC_INIT(1), \ | |
820e45db | 85 | .tasks = { \ |
f2001145 ON |
86 | { .first = NULL }, \ |
87 | { .first = NULL }, \ | |
88 | { .first = NULL }, \ | |
820e45db | 89 | }, \ |
4c3f2ead SB |
90 | .level = 0, \ |
91 | .numbers = { { \ | |
92 | .nr = 0, \ | |
93 | .ns = &init_pid_ns, \ | |
4c3f2ead | 94 | }, } \ |
820e45db SB |
95 | } |
96 | ||
97 | #define INIT_PID_LINK(type) \ | |
98 | { \ | |
99 | .node = { \ | |
100 | .next = NULL, \ | |
f2001145 | 101 | .pprev = NULL, \ |
820e45db SB |
102 | }, \ |
103 | .pid = &init_struct_pid, \ | |
104 | } | |
105 | ||
b6dff3ec DH |
106 | extern struct cred init_cred; |
107 | ||
f1c6f1a7 CE |
108 | #define INIT_TASK_COMM "swapper" |
109 | ||
857eceeb | 110 | /* Attach to the init_task data structure for proper alignment */ |
d11ed3ab | 111 | #ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK |
2af7687f | 112 | #define __init_task_data __attribute__((__section__(".data..init_task"))) |
d11ed3ab DH |
113 | #else |
114 | #define __init_task_data /**/ | |
115 | #endif | |
857eceeb | 116 | |
0500871f DH |
117 | /* Attach to the thread_info data structure for proper alignment */ |
118 | #define __init_thread_info __attribute__((__section__(".data..init_thread_info"))) | |
119 | ||
1da177e4 | 120 | #endif |