xref: /linux-6.15/include/linux/init_task.h (revision 3678e2fc)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds #ifndef _LINUX__INIT_TASK_H
31da177e4SLinus Torvalds #define _LINUX__INIT_TASK_H
41da177e4SLinus Torvalds 
5ab2af1f5SDipankar Sarma #include <linux/rcupdate.h>
6de30a2b3SIngo Molnar #include <linux/irqflags.h>
74865ecf1SSerge E. Hallyn #include <linux/utsname.h>
8fbb9ce95SIngo Molnar #include <linux/lockdep.h>
95ac9f622SSteven Rostedt #include <linux/ftrace.h>
1073ea4130SKirill Korotaev #include <linux/ipc.h>
119a575a92SCedric Le Goater #include <linux/pid_namespace.h>
12acce292cSCedric Le Goater #include <linux/user_namespace.h>
133898b1b4SAndrew G. Morgan #include <linux/securebits.h>
146a61671bSFrederic Weisbecker #include <linux/seqlock.h>
15fb00aca4SPeter Zijlstra #include <linux/rbtree.h>
16dfc3401aSIngo Molnar #include <linux/sched/autogroup.h>
17772698f6SEric W. Biederman #include <net/net_namespace.h>
1877852feaSIngo Molnar #include <linux/sched/rt.h>
19d83a7cb3SJosh Poimboeuf #include <linux/livepatch.h>
20589ee628SIngo Molnar #include <linux/mm_types.h>
211da177e4SLinus Torvalds 
22c65eacbeSAndy Lutomirski #include <asm/thread_info.h>
23c65eacbeSAndy Lutomirski 
24f52111b1SAl Viro extern struct files_struct init_files;
2518d8fda7SAl Viro extern struct fs_struct init_fs;
26*3678e2fcSDavid Howells extern struct nsproxy init_nsproxy;
27*3678e2fcSDavid Howells extern struct group_info init_groups;
28*3678e2fcSDavid Howells extern struct cred init_cred;
291da177e4SLinus Torvalds 
309d7fb042SPeter Zijlstra #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
319d7fb042SPeter Zijlstra #define INIT_PREV_CPUTIME(x)	.prev_cputime = {			\
329d7fb042SPeter Zijlstra 	.lock = __RAW_SPIN_LOCK_UNLOCKED(x.prev_cputime.lock),		\
339d7fb042SPeter Zijlstra },
349d7fb042SPeter Zijlstra #else
359d7fb042SPeter Zijlstra #define INIT_PREV_CPUTIME(x)
369d7fb042SPeter Zijlstra #endif
379d7fb042SPeter Zijlstra 
38b18b6a9cSNicolas Pitre #ifdef CONFIG_POSIX_TIMERS
39b18b6a9cSNicolas Pitre #define INIT_CPU_TIMERS(s)						\
40b18b6a9cSNicolas Pitre 	.cpu_timers = {							\
41b18b6a9cSNicolas Pitre 		LIST_HEAD_INIT(s.cpu_timers[0]),			\
42b18b6a9cSNicolas Pitre 		LIST_HEAD_INIT(s.cpu_timers[1]),			\
43b18b6a9cSNicolas Pitre 		LIST_HEAD_INIT(s.cpu_timers[2]),			\
44b18b6a9cSNicolas Pitre 	},
45b18b6a9cSNicolas Pitre #else
46b18b6a9cSNicolas Pitre #define INIT_CPU_TIMERS(s)
47b18b6a9cSNicolas Pitre #endif
48b18b6a9cSNicolas Pitre 
491da177e4SLinus Torvalds 
50820e45dbSSukadev Bhattiprolu #define INIT_STRUCT_PID {						\
51820e45dbSSukadev Bhattiprolu 	.count 		= ATOMIC_INIT(1),				\
52820e45dbSSukadev Bhattiprolu 	.tasks		= {						\
53f2001145SOleg Nesterov 		{ .first = NULL },					\
54f2001145SOleg Nesterov 		{ .first = NULL },					\
55f2001145SOleg Nesterov 		{ .first = NULL },					\
56820e45dbSSukadev Bhattiprolu 	},								\
574c3f2eadSSukadev Bhattiprolu 	.level		= 0,						\
584c3f2eadSSukadev Bhattiprolu 	.numbers	= { {						\
594c3f2eadSSukadev Bhattiprolu 		.nr		= 0,					\
604c3f2eadSSukadev Bhattiprolu 		.ns		= &init_pid_ns,				\
614c3f2eadSSukadev Bhattiprolu 	}, }								\
62820e45dbSSukadev Bhattiprolu }
63820e45dbSSukadev Bhattiprolu 
64820e45dbSSukadev Bhattiprolu #define INIT_PID_LINK(type) 					\
65820e45dbSSukadev Bhattiprolu {								\
66820e45dbSSukadev Bhattiprolu 	.node = {						\
67820e45dbSSukadev Bhattiprolu 		.next = NULL,					\
68f2001145SOleg Nesterov 		.pprev = NULL,					\
69820e45dbSSukadev Bhattiprolu 	},							\
70820e45dbSSukadev Bhattiprolu 	.pid = &init_struct_pid,				\
71820e45dbSSukadev Bhattiprolu }
72820e45dbSSukadev Bhattiprolu 
73f1c6f1a7SCarsten Emde #define INIT_TASK_COMM "swapper"
74f1c6f1a7SCarsten Emde 
75857eceebSTim Abbott /* Attach to the init_task data structure for proper alignment */
76d11ed3abSDavid Howells #ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK
772af7687fSTim Abbott #define __init_task_data __attribute__((__section__(".data..init_task")))
78d11ed3abSDavid Howells #else
79d11ed3abSDavid Howells #define __init_task_data /**/
80d11ed3abSDavid Howells #endif
81857eceebSTim Abbott 
820500871fSDavid Howells /* Attach to the thread_info data structure for proper alignment */
830500871fSDavid Howells #define __init_thread_info __attribute__((__section__(".data..init_thread_info")))
840500871fSDavid Howells 
851da177e4SLinus Torvalds #endif
86