1 /* A GNU-like <sched.h>.
2    Copyright (C) 2008-2021 Free Software Foundation, Inc.
3 
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
16 
17 #ifndef _@GUARD_PREFIX@_SCHED_H
18 
19 #if __GNUC__ >= 3
20 @PRAGMA_SYSTEM_HEADER@
21 #endif
22 @PRAGMA_COLUMNS@
23 
24 /* The include_next requires a split double-inclusion guard.  */
25 #if @HAVE_SCHED_H@
26 # if @HAVE_SYS_CDEFS_H@
27 #  include <sys/cdefs.h>
28 # endif
29 # @INCLUDE_NEXT@ @NEXT_SCHED_H@
30 #endif
31 
32 #ifndef _@GUARD_PREFIX@_SCHED_H
33 #define _@GUARD_PREFIX@_SCHED_H
34 
35 /* Get pid_t.
36    This is needed on glibc 2.11 (see
37    glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=13198>)
38    and Mac OS X 10.5.  */
39 #include <sys/types.h>
40 
41 #ifdef __KLIBC__
42 /* On OS/2 kLIBC, struct sched_param is in spawn.h.  */
43 # include <spawn.h>
44 #endif
45 
46 #ifdef __VMS
47 /* On OpenVMS, struct sched_param is in <pthread.h>.  */
48 # include <pthread.h>
49 #endif
50 
51 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
52 
53 /* The definition of _GL_WARN_ON_USE is copied here.  */
54 
55 #if !@HAVE_STRUCT_SCHED_PARAM@
56 
57 # if !GNULIB_defined_struct_sched_param
58 struct sched_param
59 {
60   int sched_priority;
61 };
62 #  define GNULIB_defined_struct_sched_param 1
63 # endif
64 
65 #endif
66 
67 #if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER)
68 # define SCHED_FIFO   1
69 # define SCHED_RR     2
70 # define SCHED_OTHER  0
71 #endif
72 
73 #if @GNULIB_SCHED_YIELD@
74 # if @REPLACE_SCHED_YIELD@
75 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
76 #   undef sched_yield
77 #   define sched_yield rpl_sched_yield
78 #  endif
79 _GL_FUNCDECL_RPL (sched_yield, int, (void));
80 _GL_CXXALIAS_RPL (sched_yield, int, (void));
81 # else
82 #  if !@HAVE_SCHED_YIELD@
83 _GL_FUNCDECL_SYS (sched_yield, int, (void));
84 #  endif
85 _GL_CXXALIAS_SYS (sched_yield, int, (void));
86 # endif
87 # if __GLIBC__ >= 2
88 _GL_CXXALIASWARN (sched_yield);
89 # endif
90 #elif defined GNULIB_POSIXCHECK
91 # undef sched_yield
92 # if HAVE_RAW_DECL_SCHED_YIELD
93 _GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - "
94                  "use gnulib module sched_yield for portability");
95 # endif
96 #endif
97 
98 #endif /* _@GUARD_PREFIX@_SCHED_H */
99 #endif /* _@GUARD_PREFIX@_SCHED_H */
100