sched.in.h 2.6 KB

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