1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* A GNU-like <sched.h>.
3 Copyright (C) 2008-2019 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#ifndef _GL_SCHED_H
19
20#if __GNUC__ >= 3
21#pragma GCC system_header
22#endif
23
24
25/* The include_next requires a split double-inclusion guard. */
26#if 1
27# if 1
28# include <sys/cdefs.h>
29# endif
30# include_next <sched.h>
31#endif
32
33#ifndef _GL_SCHED_H
34#define _GL_SCHED_H
35
36/* Get pid_t.
37 This is needed on glibc 2.11 (see
38 glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=13198>)
39 and Mac OS X 10.5. */
40#include <sys/types.h>
41
42#ifdef __KLIBC__
43/* On OS/2 kLIBC, struct sched_param is in spawn.h. */
44# include <spawn.h>
45#endif
46
47#ifdef __VMS
48/* On OpenVMS, struct sched_param is in <pthread.h>. */
49# include <pthread.h>
50#endif
51
52/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
53/* C++ compatible function declaration macros.
54 Copyright (C) 2010-2019 Free Software Foundation, Inc.
55
56 This program is free software: you can redistribute it and/or modify it
57 under the terms of the GNU General Public License as published
58 by the Free Software Foundation; either version 3 of the License, or
59 (at your option) any later version.
60
61 This program is distributed in the hope that it will be useful,
62 but WITHOUT ANY WARRANTY; without even the implied warranty of
63 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64 General Public License for more details.
65
66 You should have received a copy of the GNU General Public License
67 along with this program. If not, see <https://www.gnu.org/licenses/>. */
68
69#ifndef _GL_CXXDEFS_H
70#define _GL_CXXDEFS_H
71
72/* Begin/end the GNULIB_NAMESPACE namespace. */
73#if defined __cplusplus && defined GNULIB_NAMESPACE
74# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
75# define _GL_END_NAMESPACE }
76#else
77# define _GL_BEGIN_NAMESPACE
78# define _GL_END_NAMESPACE
79#endif
80
81/* The three most frequent use cases of these macros are:
82
83 * For providing a substitute for a function that is missing on some
84 platforms, but is declared and works fine on the platforms on which
85 it exists:
86
87 #if @GNULIB_FOO@
88 # if !@HAVE_FOO@
89 _GL_FUNCDECL_SYS (foo, ...);
90 # endif
91 _GL_CXXALIAS_SYS (foo, ...);
92 _GL_CXXALIASWARN (foo);
93 #elif defined GNULIB_POSIXCHECK
94 ...
95 #endif
96
97 * For providing a replacement for a function that exists on all platforms,
98 but is broken/insufficient and needs to be replaced on some platforms:
99
100 #if @GNULIB_FOO@
101 # if @REPLACE_FOO@
102 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103 # undef foo
104 # define foo rpl_foo
105 # endif
106 _GL_FUNCDECL_RPL (foo, ...);
107 _GL_CXXALIAS_RPL (foo, ...);
108 # else
109 _GL_CXXALIAS_SYS (foo, ...);
110 # endif
111 _GL_CXXALIASWARN (foo);
112 #elif defined GNULIB_POSIXCHECK
113 ...
114 #endif
115
116 * For providing a replacement for a function that exists on some platforms
117 but is broken/insufficient and needs to be replaced on some of them and
118 is additionally either missing or undeclared on some other platforms:
119
120 #if @GNULIB_FOO@
121 # if @REPLACE_FOO@
122 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
123 # undef foo
124 # define foo rpl_foo
125 # endif
126 _GL_FUNCDECL_RPL (foo, ...);
127 _GL_CXXALIAS_RPL (foo, ...);
128 # else
129 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
130 _GL_FUNCDECL_SYS (foo, ...);
131 # endif
132 _GL_CXXALIAS_SYS (foo, ...);
133 # endif
134 _GL_CXXALIASWARN (foo);
135 #elif defined GNULIB_POSIXCHECK
136 ...
137 #endif
138*/
139
140/* _GL_EXTERN_C declaration;
141 performs the declaration with C linkage. */
142#if defined __cplusplus
143# define _GL_EXTERN_C extern "C"
144#else
145# define _GL_EXTERN_C extern
146#endif
147
148/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
149 declares a replacement function, named rpl_func, with the given prototype,
150 consisting of return type, parameters, and attributes.
151 Example:
152 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
153 _GL_ARG_NONNULL ((1)));
154 */
155#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
156 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
157#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
158 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
159
160/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
161 declares the system function, named func, with the given prototype,
162 consisting of return type, parameters, and attributes.
163 Example:
164 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
165 _GL_ARG_NONNULL ((1)));
166 */
167#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
168 _GL_EXTERN_C rettype func parameters_and_attributes
169
170/* _GL_CXXALIAS_RPL (func, rettype, parameters);
171 declares a C++ alias called GNULIB_NAMESPACE::func
172 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
173 Example:
174 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
175
176 Wrapping rpl_func in an object with an inline conversion operator
177 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
178 actually used in the program. */
179#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
180 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
181#if defined __cplusplus && defined GNULIB_NAMESPACE
182# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
183 namespace GNULIB_NAMESPACE \
184 { \
185 static const struct _gl_ ## func ## _wrapper \
186 { \
187 typedef rettype (*type) parameters; \
188 \
189 inline operator type () const \
190 { \
191 return ::rpl_func; \
192 } \
193 } func = {}; \
194 } \
195 _GL_EXTERN_C int _gl_cxxalias_dummy
196#else
197# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
198 _GL_EXTERN_C int _gl_cxxalias_dummy
199#endif
200
201/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
202 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
203 except that the C function rpl_func may have a slightly different
204 declaration. A cast is used to silence the "invalid conversion" error
205 that would otherwise occur. */
206#if defined __cplusplus && defined GNULIB_NAMESPACE
207# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
208 namespace GNULIB_NAMESPACE \
209 { \
210 static const struct _gl_ ## func ## _wrapper \
211 { \
212 typedef rettype (*type) parameters; \
213 \
214 inline operator type () const \
215 { \
216 return reinterpret_cast<type>(::rpl_func); \
217 } \
218 } func = {}; \
219 } \
220 _GL_EXTERN_C int _gl_cxxalias_dummy
221#else
222# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
223 _GL_EXTERN_C int _gl_cxxalias_dummy
224#endif
225
226/* _GL_CXXALIAS_SYS (func, rettype, parameters);
227 declares a C++ alias called GNULIB_NAMESPACE::func
228 that redirects to the system provided function func, if GNULIB_NAMESPACE
229 is defined.
230 Example:
231 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
232
233 Wrapping func in an object with an inline conversion operator
234 avoids a reference to func unless GNULIB_NAMESPACE::func is
235 actually used in the program. */
236#if defined __cplusplus && defined GNULIB_NAMESPACE
237# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
238 namespace GNULIB_NAMESPACE \
239 { \
240 static const struct _gl_ ## func ## _wrapper \
241 { \
242 typedef rettype (*type) parameters; \
243 \
244 inline operator type () const \
245 { \
246 return ::func; \
247 } \
248 } func = {}; \
249 } \
250 _GL_EXTERN_C int _gl_cxxalias_dummy
251#else
252# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
253 _GL_EXTERN_C int _gl_cxxalias_dummy
254#endif
255
256/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
257 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
258 except that the C function func may have a slightly different declaration.
259 A cast is used to silence the "invalid conversion" error that would
260 otherwise occur. */
261#if defined __cplusplus && defined GNULIB_NAMESPACE
262# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
263 namespace GNULIB_NAMESPACE \
264 { \
265 static const struct _gl_ ## func ## _wrapper \
266 { \
267 typedef rettype (*type) parameters; \
268 \
269 inline operator type () const \
270 { \
271 return reinterpret_cast<type>(::func); \
272 } \
273 } func = {}; \
274 } \
275 _GL_EXTERN_C int _gl_cxxalias_dummy
276#else
277# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
278 _GL_EXTERN_C int _gl_cxxalias_dummy
279#endif
280
281/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
282 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
283 except that the C function is picked among a set of overloaded functions,
284 namely the one with rettype2 and parameters2. Two consecutive casts
285 are used to silence the "cannot find a match" and "invalid conversion"
286 errors that would otherwise occur. */
287#if defined __cplusplus && defined GNULIB_NAMESPACE
288 /* The outer cast must be a reinterpret_cast.
289 The inner cast: When the function is defined as a set of overloaded
290 functions, it works as a static_cast<>, choosing the designated variant.
291 When the function is defined as a single variant, it works as a
292 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
293# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
294 namespace GNULIB_NAMESPACE \
295 { \
296 static const struct _gl_ ## func ## _wrapper \
297 { \
298 typedef rettype (*type) parameters; \
299 \
300 inline operator type () const \
301 { \
302 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
303 } \
304 } func = {}; \
305 } \
306 _GL_EXTERN_C int _gl_cxxalias_dummy
307#else
308# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
309 _GL_EXTERN_C int _gl_cxxalias_dummy
310#endif
311
312/* _GL_CXXALIASWARN (func);
313 causes a warning to be emitted when ::func is used but not when
314 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
315 variants. */
316#if defined __cplusplus && defined GNULIB_NAMESPACE
317# define _GL_CXXALIASWARN(func) \
318 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
319# define _GL_CXXALIASWARN_1(func,namespace) \
320 _GL_CXXALIASWARN_2 (func, namespace)
321/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
322 we enable the warning only when not optimizing. */
323# if !__OPTIMIZE__
324# define _GL_CXXALIASWARN_2(func,namespace) \
325 _GL_WARN_ON_USE (func, \
326 "The symbol ::" #func " refers to the system function. " \
327 "Use " #namespace "::" #func " instead.")
328# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
329# define _GL_CXXALIASWARN_2(func,namespace) \
330 extern __typeof__ (func) func
331# else
332# define _GL_CXXALIASWARN_2(func,namespace) \
333 _GL_EXTERN_C int _gl_cxxalias_dummy
334# endif
335#else
336# define _GL_CXXALIASWARN(func) \
337 _GL_EXTERN_C int _gl_cxxalias_dummy
338#endif
339
340/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
341 causes a warning to be emitted when the given overloaded variant of ::func
342 is used but not when GNULIB_NAMESPACE::func is used. */
343#if defined __cplusplus && defined GNULIB_NAMESPACE
344# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
345 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
346 GNULIB_NAMESPACE)
347# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
348 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
349/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
350 we enable the warning only when not optimizing. */
351# if !__OPTIMIZE__
352# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
353 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
354 "The symbol ::" #func " refers to the system function. " \
355 "Use " #namespace "::" #func " instead.")
356# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
357# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
358 extern __typeof__ (func) func
359# else
360# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
361 _GL_EXTERN_C int _gl_cxxalias_dummy
362# endif
363#else
364# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
365 _GL_EXTERN_C int _gl_cxxalias_dummy
366#endif
367
368#endif /* _GL_CXXDEFS_H */
369
370/* The definition of _GL_WARN_ON_USE is copied here. */
371/* A C macro for emitting warnings if a function is used.
372 Copyright (C) 2010-2019 Free Software Foundation, Inc.
373
374 This program is free software: you can redistribute it and/or modify it
375 under the terms of the GNU General Public License as published
376 by the Free Software Foundation; either version 3 of the License, or
377 (at your option) any later version.
378
379 This program is distributed in the hope that it will be useful,
380 but WITHOUT ANY WARRANTY; without even the implied warranty of
381 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
382 General Public License for more details.
383
384 You should have received a copy of the GNU General Public License
385 along with this program. If not, see <https://www.gnu.org/licenses/>. */
386
387/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
388 for FUNCTION which will then trigger a compiler warning containing
389 the text of "literal string" anywhere that function is called, if
390 supported by the compiler. If the compiler does not support this
391 feature, the macro expands to an unused extern declaration.
392
393 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
394 attribute used in _GL_WARN_ON_USE. If the compiler does not support
395 this feature, it expands to empty.
396
397 These macros are useful for marking a function as a potential
398 portability trap, with the intent that "literal string" include
399 instructions on the replacement function that should be used
400 instead.
401 _GL_WARN_ON_USE is for functions with 'extern' linkage.
402 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
403 linkage.
404
405 However, one of the reasons that a function is a portability trap is
406 if it has the wrong signature. Declaring FUNCTION with a different
407 signature in C is a compilation error, so this macro must use the
408 same type as any existing declaration so that programs that avoid
409 the problematic FUNCTION do not fail to compile merely because they
410 included a header that poisoned the function. But this implies that
411 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
412 have a declaration. Use of this macro implies that there must not
413 be any other macro hiding the declaration of FUNCTION; but
414 undefining FUNCTION first is part of the poisoning process anyway
415 (although for symbols that are provided only via a macro, the result
416 is a compilation error rather than a warning containing
417 "literal string"). Also note that in C++, it is only safe to use if
418 FUNCTION has no overloads.
419
420 For an example, it is possible to poison 'getline' by:
421 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
422 [getline]) in configure.ac, which potentially defines
423 HAVE_RAW_DECL_GETLINE
424 - adding this code to a header that wraps the system <stdio.h>:
425 #undef getline
426 #if HAVE_RAW_DECL_GETLINE
427 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
428 "not universally present; use the gnulib module getline");
429 #endif
430
431 It is not possible to directly poison global variables. But it is
432 possible to write a wrapper accessor function, and poison that
433 (less common usage, like &environ, will cause a compilation error
434 rather than issue the nice warning, but the end result of informing
435 the developer about their portability problem is still achieved):
436 #if HAVE_RAW_DECL_ENVIRON
437 static char ***
438 rpl_environ (void) { return &environ; }
439 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
440 # undef environ
441 # define environ (*rpl_environ ())
442 #endif
443 or better (avoiding contradictory use of 'static' and 'extern'):
444 #if HAVE_RAW_DECL_ENVIRON
445 static char ***
446 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
447 rpl_environ (void) { return &environ; }
448 # undef environ
449 # define environ (*rpl_environ ())
450 #endif
451 */
452#ifndef _GL_WARN_ON_USE
453
454# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
455/* A compiler attribute is available in gcc versions 4.3.0 and later. */
456# define _GL_WARN_ON_USE(function, message) \
457extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
458# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
459 __attribute__ ((__warning__ (message)))
460# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
461/* Verify the existence of the function. */
462# define _GL_WARN_ON_USE(function, message) \
463extern __typeof__ (function) function
464# define _GL_WARN_ON_USE_ATTRIBUTE(message)
465# else /* Unsupported. */
466# define _GL_WARN_ON_USE(function, message) \
467_GL_WARN_EXTERN_C int _gl_warn_on_use
468# define _GL_WARN_ON_USE_ATTRIBUTE(message)
469# endif
470#endif
471
472/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
473 is like _GL_WARN_ON_USE (function, "string"), except that the function is
474 declared with the given prototype, consisting of return type, parameters,
475 and attributes.
476 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
477 not work in this case. */
478#ifndef _GL_WARN_ON_USE_CXX
479# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
480# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
481extern rettype function parameters_and_attributes \
482 __attribute__ ((__warning__ (msg)))
483# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
484/* Verify the existence of the function. */
485# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
486extern rettype function parameters_and_attributes
487# else /* Unsupported. */
488# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
489_GL_WARN_EXTERN_C int _gl_warn_on_use
490# endif
491#endif
492
493/* _GL_WARN_EXTERN_C declaration;
494 performs the declaration with C linkage. */
495#ifndef _GL_WARN_EXTERN_C
496# if defined __cplusplus
497# define _GL_WARN_EXTERN_C extern "C"
498# else
499# define _GL_WARN_EXTERN_C extern
500# endif
501#endif
502
503#if !1
504
505# if !GNULIB_defined_struct_sched_param
506struct sched_param
507{
508 int sched_priority;
509};
510# define GNULIB_defined_struct_sched_param 1
511# endif
512
513#endif
514
515#if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER)
516# define SCHED_FIFO 1
517# define SCHED_RR 2
518# define SCHED_OTHER 0
519#endif
520
521#if 0
522# if 0
523# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
524# undef sched_yield
525# define sched_yield rpl_sched_yield
526# endif
527_GL_FUNCDECL_RPL (sched_yield, int, (void));
528_GL_CXXALIAS_RPL (sched_yield, int, (void));
529# else
530# if !1
531_GL_FUNCDECL_SYS (sched_yield, int, (void));
532# endif
533_GL_CXXALIAS_SYS (sched_yield, int, (void));
534# endif
535_GL_CXXALIASWARN (sched_yield);
536#elif defined GNULIB_POSIXCHECK
537# undef sched_yield
538# if HAVE_RAW_DECL_SCHED_YIELD
539_GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - "
540 "use gnulib module sched_yield for portability");
541# endif
542#endif
543
544#endif /* _GL_SCHED_H */
545#endif /* _GL_SCHED_H */
546