18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci#ifndef _UAPI_LINUX_SCHED_H 38c2ecf20Sopenharmony_ci#define _UAPI_LINUX_SCHED_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/types.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/* 88c2ecf20Sopenharmony_ci * cloning flags: 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ 118c2ecf20Sopenharmony_ci#define CLONE_VM 0x00000100 /* set if VM shared between processes */ 128c2ecf20Sopenharmony_ci#define CLONE_FS 0x00000200 /* set if fs info shared between processes */ 138c2ecf20Sopenharmony_ci#define CLONE_FILES 0x00000400 /* set if open files shared between processes */ 148c2ecf20Sopenharmony_ci#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ 158c2ecf20Sopenharmony_ci#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */ 168c2ecf20Sopenharmony_ci#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ 178c2ecf20Sopenharmony_ci#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ 188c2ecf20Sopenharmony_ci#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ 198c2ecf20Sopenharmony_ci#define CLONE_THREAD 0x00010000 /* Same thread group? */ 208c2ecf20Sopenharmony_ci#define CLONE_NEWNS 0x00020000 /* New mount namespace group */ 218c2ecf20Sopenharmony_ci#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ 228c2ecf20Sopenharmony_ci#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ 238c2ecf20Sopenharmony_ci#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ 248c2ecf20Sopenharmony_ci#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ 258c2ecf20Sopenharmony_ci#define CLONE_DETACHED 0x00400000 /* Unused, ignored */ 268c2ecf20Sopenharmony_ci#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ 278c2ecf20Sopenharmony_ci#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ 288c2ecf20Sopenharmony_ci#define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace */ 298c2ecf20Sopenharmony_ci#define CLONE_NEWUTS 0x04000000 /* New utsname namespace */ 308c2ecf20Sopenharmony_ci#define CLONE_NEWIPC 0x08000000 /* New ipc namespace */ 318c2ecf20Sopenharmony_ci#define CLONE_NEWUSER 0x10000000 /* New user namespace */ 328c2ecf20Sopenharmony_ci#define CLONE_NEWPID 0x20000000 /* New pid namespace */ 338c2ecf20Sopenharmony_ci#define CLONE_NEWNET 0x40000000 /* New network namespace */ 348c2ecf20Sopenharmony_ci#define CLONE_IO 0x80000000 /* Clone io context */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* Flags for the clone3() syscall. */ 378c2ecf20Sopenharmony_ci#define CLONE_CLEAR_SIGHAND 0x100000000ULL /* Clear any signal handler and reset to SIG_DFL. */ 388c2ecf20Sopenharmony_ci#define CLONE_INTO_CGROUP 0x200000000ULL /* Clone into a specific cgroup given the right permissions. */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/* 418c2ecf20Sopenharmony_ci * cloning flags intersect with CSIGNAL so can be used with unshare and clone3 428c2ecf20Sopenharmony_ci * syscalls only: 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_ci#define CLONE_NEWTIME 0x00000080 /* New time namespace */ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 478c2ecf20Sopenharmony_ci/** 488c2ecf20Sopenharmony_ci * struct clone_args - arguments for the clone3 syscall 498c2ecf20Sopenharmony_ci * @flags: Flags for the new process as listed above. 508c2ecf20Sopenharmony_ci * All flags are valid except for CSIGNAL and 518c2ecf20Sopenharmony_ci * CLONE_DETACHED. 528c2ecf20Sopenharmony_ci * @pidfd: If CLONE_PIDFD is set, a pidfd will be 538c2ecf20Sopenharmony_ci * returned in this argument. 548c2ecf20Sopenharmony_ci * @child_tid: If CLONE_CHILD_SETTID is set, the TID of the 558c2ecf20Sopenharmony_ci * child process will be returned in the child's 568c2ecf20Sopenharmony_ci * memory. 578c2ecf20Sopenharmony_ci * @parent_tid: If CLONE_PARENT_SETTID is set, the TID of 588c2ecf20Sopenharmony_ci * the child process will be returned in the 598c2ecf20Sopenharmony_ci * parent's memory. 608c2ecf20Sopenharmony_ci * @exit_signal: The exit_signal the parent process will be 618c2ecf20Sopenharmony_ci * sent when the child exits. 628c2ecf20Sopenharmony_ci * @stack: Specify the location of the stack for the 638c2ecf20Sopenharmony_ci * child process. 648c2ecf20Sopenharmony_ci * Note, @stack is expected to point to the 658c2ecf20Sopenharmony_ci * lowest address. The stack direction will be 668c2ecf20Sopenharmony_ci * determined by the kernel and set up 678c2ecf20Sopenharmony_ci * appropriately based on @stack_size. 688c2ecf20Sopenharmony_ci * @stack_size: The size of the stack for the child process. 698c2ecf20Sopenharmony_ci * @tls: If CLONE_SETTLS is set, the tls descriptor 708c2ecf20Sopenharmony_ci * is set to tls. 718c2ecf20Sopenharmony_ci * @set_tid: Pointer to an array of type *pid_t. The size 728c2ecf20Sopenharmony_ci * of the array is defined using @set_tid_size. 738c2ecf20Sopenharmony_ci * This array is used to select PIDs/TIDs for 748c2ecf20Sopenharmony_ci * newly created processes. The first element in 758c2ecf20Sopenharmony_ci * this defines the PID in the most nested PID 768c2ecf20Sopenharmony_ci * namespace. Each additional element in the array 778c2ecf20Sopenharmony_ci * defines the PID in the parent PID namespace of 788c2ecf20Sopenharmony_ci * the original PID namespace. If the array has 798c2ecf20Sopenharmony_ci * less entries than the number of currently 808c2ecf20Sopenharmony_ci * nested PID namespaces only the PIDs in the 818c2ecf20Sopenharmony_ci * corresponding namespaces are set. 828c2ecf20Sopenharmony_ci * @set_tid_size: This defines the size of the array referenced 838c2ecf20Sopenharmony_ci * in @set_tid. This cannot be larger than the 848c2ecf20Sopenharmony_ci * kernel's limit of nested PID namespaces. 858c2ecf20Sopenharmony_ci * @cgroup: If CLONE_INTO_CGROUP is specified set this to 868c2ecf20Sopenharmony_ci * a file descriptor for the cgroup. 878c2ecf20Sopenharmony_ci * 888c2ecf20Sopenharmony_ci * The structure is versioned by size and thus extensible. 898c2ecf20Sopenharmony_ci * New struct members must go at the end of the struct and 908c2ecf20Sopenharmony_ci * must be properly 64bit aligned. 918c2ecf20Sopenharmony_ci */ 928c2ecf20Sopenharmony_cistruct clone_args { 938c2ecf20Sopenharmony_ci __aligned_u64 flags; 948c2ecf20Sopenharmony_ci __aligned_u64 pidfd; 958c2ecf20Sopenharmony_ci __aligned_u64 child_tid; 968c2ecf20Sopenharmony_ci __aligned_u64 parent_tid; 978c2ecf20Sopenharmony_ci __aligned_u64 exit_signal; 988c2ecf20Sopenharmony_ci __aligned_u64 stack; 998c2ecf20Sopenharmony_ci __aligned_u64 stack_size; 1008c2ecf20Sopenharmony_ci __aligned_u64 tls; 1018c2ecf20Sopenharmony_ci __aligned_u64 set_tid; 1028c2ecf20Sopenharmony_ci __aligned_u64 set_tid_size; 1038c2ecf20Sopenharmony_ci __aligned_u64 cgroup; 1048c2ecf20Sopenharmony_ci}; 1058c2ecf20Sopenharmony_ci#endif 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */ 1088c2ecf20Sopenharmony_ci#define CLONE_ARGS_SIZE_VER1 80 /* sizeof second published struct */ 1098c2ecf20Sopenharmony_ci#define CLONE_ARGS_SIZE_VER2 88 /* sizeof third published struct */ 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* 1128c2ecf20Sopenharmony_ci * Scheduling policies 1138c2ecf20Sopenharmony_ci */ 1148c2ecf20Sopenharmony_ci#define SCHED_NORMAL 0 1158c2ecf20Sopenharmony_ci#define SCHED_FIFO 1 1168c2ecf20Sopenharmony_ci#define SCHED_RR 2 1178c2ecf20Sopenharmony_ci#define SCHED_BATCH 3 1188c2ecf20Sopenharmony_ci/* SCHED_ISO: reserved but not implemented yet */ 1198c2ecf20Sopenharmony_ci#define SCHED_IDLE 5 1208c2ecf20Sopenharmony_ci#define SCHED_DEADLINE 6 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */ 1238c2ecf20Sopenharmony_ci#define SCHED_RESET_ON_FORK 0x40000000 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci/* 1268c2ecf20Sopenharmony_ci * For the sched_{set,get}attr() calls 1278c2ecf20Sopenharmony_ci */ 1288c2ecf20Sopenharmony_ci#define SCHED_FLAG_RESET_ON_FORK 0x01 1298c2ecf20Sopenharmony_ci#define SCHED_FLAG_RECLAIM 0x02 1308c2ecf20Sopenharmony_ci#define SCHED_FLAG_DL_OVERRUN 0x04 1318c2ecf20Sopenharmony_ci#define SCHED_FLAG_KEEP_POLICY 0x08 1328c2ecf20Sopenharmony_ci#define SCHED_FLAG_KEEP_PARAMS 0x10 1338c2ecf20Sopenharmony_ci#define SCHED_FLAG_UTIL_CLAMP_MIN 0x20 1348c2ecf20Sopenharmony_ci#define SCHED_FLAG_UTIL_CLAMP_MAX 0x40 1358c2ecf20Sopenharmony_ci#define SCHED_FLAG_LATENCY_NICE 0X80 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci#define SCHED_FLAG_KEEP_ALL (SCHED_FLAG_KEEP_POLICY | \ 1388c2ecf20Sopenharmony_ci SCHED_FLAG_KEEP_PARAMS) 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci#define SCHED_FLAG_UTIL_CLAMP (SCHED_FLAG_UTIL_CLAMP_MIN | \ 1418c2ecf20Sopenharmony_ci SCHED_FLAG_UTIL_CLAMP_MAX) 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci#define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | \ 1448c2ecf20Sopenharmony_ci SCHED_FLAG_RECLAIM | \ 1458c2ecf20Sopenharmony_ci SCHED_FLAG_DL_OVERRUN | \ 1468c2ecf20Sopenharmony_ci SCHED_FLAG_KEEP_ALL | \ 1478c2ecf20Sopenharmony_ci SCHED_FLAG_UTIL_CLAMP | \ 1488c2ecf20Sopenharmony_ci SCHED_FLAG_LATENCY_NICE) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#endif /* _UAPI_LINUX_SCHED_H */ 151