1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *  * Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *    the documentation and/or other materials provided with the
13  *    distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #if !defined(DO_NOT_INCLUDE_SCHED_H)
30 #include <sched.h>
31 #endif
32 
33 #include "header_checks.h"
34 
sched_h()35 static void sched_h() {
36   TYPE(pid_t);
37   TYPE(time_t);
38   TYPE(struct timespec);
39 
40   TYPE(struct sched_param);
41   STRUCT_MEMBER(struct sched_param, int, sched_priority);
42 #if !defined(__linux__)
43   STRUCT_MEMBER(struct sched_param, int, sched_ss_low_priority);
44   STRUCT_MEMBER(struct sched_param, struct timespec, sched_ss_repl_period);
45   STRUCT_MEMBER(struct sched_param, struct timespec, sched_ss_init_budget);
46   STRUCT_MEMBER(struct sched_param, int, sched_ss_max_repl);
47 #endif
48 
49   MACRO(SCHED_FIFO);
50   MACRO(SCHED_RR);
51 #if !defined(__linux__)
52   MACRO(SCHED_SPORADIC);
53 #endif
54   MACRO(SCHED_OTHER);
55 
56   FUNCTION(sched_get_priority_max, int (*f)(int));
57   FUNCTION(sched_get_priority_min, int (*f)(int));
58   FUNCTION(sched_getparam, int (*f)(pid_t, struct sched_param*));
59   FUNCTION(sched_getscheduler, int (*f)(pid_t));
60   FUNCTION(sched_rr_get_interval, int (*f)(pid_t, struct timespec*));
61   FUNCTION(sched_setparam, int (*f)(pid_t, const struct sched_param*));
62   FUNCTION(sched_setscheduler, int (*f)(pid_t, int, const struct sched_param*));
63   FUNCTION(sched_yield, int (*f)(void));
64 }
65