1 
2 /*
3  * Copyright (C) 2015-2021 Alibaba Group Holding Limited
4  */
5 
6 #ifndef _SCHED_H
7 #define _SCHED_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #include <stdint.h>
14 #include <sys/types.h>
15 #include <sys/timespec.h>
16 
17 /* The scheduling policy */
18 #define SCHED_OTHER 0
19 #define SCHED_FIFO  1
20 #define SCHED_RR    2
21 #define SCHED_CFS   3
22 
23 struct sched_param {
24     int      sched_priority; /* process execution scheduling priority */
25     uint64_t slice;          /* time slice in SCHED_RR mode (ms) */
26 };
27 
28 int sched_yield(void);
29 int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param);
30 int sched_get_priority_min(int policy);
31 int sched_get_priority_max(int policy);
32 int sched_rr_get_interval(pid_t pid, struct timespec *interval);
33 
34 #ifdef __cplusplus
35 }
36 #endif
37 
38 #endif /*_SCHED_H*/
39