You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Written by Joel Sherrill <joel@OARcorp.com>.
  3. *
  4. * COPYRIGHT (c) 1989-2010.
  5. * On-Line Applications Research Corporation (OAR).
  6. *
  7. * Permission to use, copy, modify, and distribute this software for any
  8. * purpose without fee is hereby granted, provided that this entire notice
  9. * is included in all copies of any software which is or includes a copy
  10. * or modification of this software.
  11. *
  12. * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
  13. * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
  14. * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
  15. * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  16. *
  17. * $Id$
  18. */
  19. #ifndef _SCHED_H_
  20. #define _SCHED_H_
  21. #include <sys/types.h>
  22. #include <sys/sched.h>
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #if defined(_POSIX_PRIORITY_SCHEDULING)
  27. /*
  28. * XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1803
  29. */
  30. int sched_setparam(
  31. pid_t __pid,
  32. const struct sched_param *__param
  33. );
  34. /*
  35. * XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1800
  36. */
  37. int sched_getparam(
  38. pid_t __pid,
  39. struct sched_param *__param
  40. );
  41. /*
  42. * XBD 13 - Set Scheduling Policy and Scheduling Parameters,
  43. * P1003.1b-2008, p. 1805
  44. */
  45. int sched_setscheduler(
  46. pid_t __pid,
  47. int __policy,
  48. const struct sched_param *__param
  49. );
  50. /*
  51. * XBD 13 - Get Scheduling Policy, P1003.1b-2008, p. 1801
  52. */
  53. int sched_getscheduler(
  54. pid_t __pid
  55. );
  56. /*
  57. * XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1799
  58. */
  59. int sched_get_priority_max(
  60. int __policy
  61. );
  62. int sched_get_priority_min(
  63. int __policy
  64. );
  65. /*
  66. * XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1802
  67. */
  68. int sched_rr_get_interval(
  69. pid_t __pid,
  70. struct timespec *__interval
  71. );
  72. #endif /* _POSIX_PRIORITY_SCHEDULING */
  73. #if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
  74. /*
  75. * XBD 13 - Yield Processor, P1003.1b-2008, p. 1807
  76. */
  77. int sched_yield( void );
  78. #endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
  79. #if __GNU_VISIBLE
  80. int sched_getcpu(void);
  81. /* The following functions should only be declared if the type
  82. cpu_set_t is defined through indirect inclusion of sys/cpuset.h,
  83. only available on some targets. */
  84. #ifdef _SYS_CPUSET_H_
  85. int sched_getaffinity (pid_t, size_t, cpu_set_t *);
  86. int sched_get_thread_affinity (void *, size_t, cpu_set_t *);
  87. int sched_setaffinity (pid_t, size_t, const cpu_set_t *);
  88. int sched_set_thread_affinity (void *, size_t, const cpu_set_t *);
  89. #endif /* _SYS_CPUSET_H_ */
  90. #endif
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif /* _SCHED_H_ */