logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

pthread_getschedparam.3p (6115B)


  1. '\" et
  2. .TH PTHREAD_GETSCHEDPARAM "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. pthread_getschedparam,
  12. pthread_setschedparam
  13. \(em dynamic thread scheduling parameters access
  14. (\fBREALTIME THREADS\fP)
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <pthread.h>
  19. .P
  20. int pthread_getschedparam(pthread_t \fIthread\fP, int *restrict \fIpolicy\fP,
  21. struct sched_param *restrict \fIparam\fP);
  22. int pthread_setschedparam(pthread_t \fIthread\fP, int \fIpolicy\fP,
  23. const struct sched_param *\fIparam\fP);
  24. .fi
  25. .SH DESCRIPTION
  26. The
  27. \fIpthread_getschedparam\fR()
  28. and
  29. \fIpthread_setschedparam\fR()
  30. functions shall, respectively, get and set the scheduling policy and
  31. parameters of individual threads within a multi-threaded process to be
  32. retrieved and set. For SCHED_FIFO and SCHED_RR,
  33. the only required member of the
  34. .BR sched_param
  35. structure is the priority
  36. .IR sched_priority .
  37. For SCHED_OTHER,
  38. the affected scheduling parameters are implementation-defined.
  39. .P
  40. The
  41. \fIpthread_getschedparam\fR()
  42. function shall retrieve the scheduling policy and scheduling parameters
  43. for the thread whose thread ID is given by
  44. .IR thread
  45. and shall store those values in
  46. .IR policy
  47. and
  48. .IR param ,
  49. respectively. The priority value returned from
  50. \fIpthread_getschedparam\fR()
  51. shall be the value specified by the most recent
  52. \fIpthread_setschedparam\fR(),
  53. \fIpthread_setschedprio\fR(),
  54. or
  55. \fIpthread_create\fR()
  56. call affecting the target thread. It shall not reflect any temporary
  57. adjustments to its priority as a result of any priority inheritance or
  58. ceiling functions. The
  59. \fIpthread_setschedparam\fR()
  60. function shall set the scheduling policy and associated scheduling
  61. parameters for the thread whose thread ID is given by
  62. .IR thread
  63. to the policy and associated parameters provided in
  64. .IR policy
  65. and
  66. .IR param ,
  67. respectively.
  68. .P
  69. The
  70. .IR policy
  71. parameter may have the value SCHED_OTHER, SCHED_FIFO, or SCHED_RR. The
  72. scheduling parameters for the SCHED_OTHER policy are
  73. implementation-defined. The SCHED_FIFO and SCHED_RR policies shall
  74. have a single scheduling parameter,
  75. .IR priority .
  76. .P
  77. If _POSIX_THREAD_SPORADIC_SERVER is defined, then the
  78. .IR policy
  79. argument may have the value SCHED_SPORADIC, with the exception for the
  80. \fIpthread_setschedparam\fR()
  81. function that if the scheduling policy was not SCHED_SPORADIC at the
  82. time of the call, it is implementation-defined whether the function
  83. is supported; in other words, the implementation need not allow the
  84. application to dynamically change the scheduling policy to
  85. SCHED_SPORADIC. The sporadic server scheduling policy has the
  86. associated parameters
  87. .IR sched_ss_low_priority ,
  88. .IR sched_ss_repl_period ,
  89. .IR sched_ss_init_budget ,
  90. .IR sched_priority ,
  91. and
  92. .IR sched_ss_max_repl .
  93. The specified
  94. .IR sched_ss_repl_period
  95. shall be greater than or equal to the specified
  96. .IR sched_ss_init_budget
  97. for the function to succeed; if it is not, then the function shall
  98. fail. The value of
  99. .IR sched_ss_max_repl
  100. shall be within the inclusive range [1,\c
  101. {SS_REPL_MAX}]
  102. for the function to succeed; if not, the function shall fail.
  103. It is unspecified whether the
  104. .IR sched_ss_repl_period
  105. and
  106. .IR sched_ss_init_budget
  107. values are stored as provided by this function or are rounded to
  108. align with the resolution of the clock being used.
  109. .P
  110. If the
  111. \fIpthread_setschedparam\fR()
  112. function fails, the scheduling parameters shall not be changed
  113. for the target thread.
  114. .SH "RETURN VALUE"
  115. If successful, the
  116. \fIpthread_getschedparam\fR()
  117. and
  118. \fIpthread_setschedparam\fR()
  119. functions shall return zero; otherwise, an error number shall be
  120. returned to indicate the error.
  121. .SH ERRORS
  122. The
  123. \fIpthread_setschedparam\fR()
  124. function shall fail if:
  125. .TP
  126. .BR ENOTSUP
  127. An attempt was made to set the policy or scheduling parameters to an
  128. unsupported value.
  129. .TP
  130. .BR ENOTSUP
  131. An attempt was made to dynamically change the scheduling policy to
  132. SCHED_SPORADIC, and the implementation does not support this change.
  133. .P
  134. The
  135. \fIpthread_setschedparam\fR()
  136. function may fail if:
  137. .TP
  138. .BR EINVAL
  139. The value specified by
  140. .IR policy
  141. or one of the scheduling parameters associated with the scheduling
  142. policy
  143. .IR policy
  144. is invalid.
  145. .TP
  146. .BR EPERM
  147. The caller does not have appropriate privileges to set either the
  148. scheduling parameters or the scheduling policy of the specified
  149. thread.
  150. .TP
  151. .BR EPERM
  152. The implementation does not allow the application to modify
  153. one of the parameters to the value specified.
  154. .P
  155. These functions shall not return an error code of
  156. .BR [EINTR] .
  157. .LP
  158. .IR "The following sections are informative."
  159. .SH EXAMPLES
  160. None.
  161. .SH "APPLICATION USAGE"
  162. None.
  163. .SH RATIONALE
  164. If an implementation detects use of a thread ID after the end of its
  165. lifetime, it is recommended that the function should fail and report an
  166. .BR [ESRCH]
  167. error.
  168. .SH "FUTURE DIRECTIONS"
  169. None.
  170. .SH "SEE ALSO"
  171. .IR "\fIpthread_setschedprio\fR\^(\|)",
  172. .IR "\fIsched_getparam\fR\^(\|)",
  173. .IR "\fIsched_getscheduler\fR\^(\|)"
  174. .P
  175. The Base Definitions volume of POSIX.1\(hy2017,
  176. .IR "\fB<pthread.h>\fP",
  177. .IR "\fB<sched.h>\fP"
  178. .\"
  179. .SH COPYRIGHT
  180. Portions of this text are reprinted and reproduced in electronic form
  181. from IEEE Std 1003.1-2017, Standard for Information Technology
  182. -- Portable Operating System Interface (POSIX), The Open Group Base
  183. Specifications Issue 7, 2018 Edition,
  184. Copyright (C) 2018 by the Institute of
  185. Electrical and Electronics Engineers, Inc and The Open Group.
  186. In the event of any discrepancy between this version and the original IEEE and
  187. The Open Group Standard, the original IEEE and The Open Group Standard
  188. is the referee document. The original Standard can be obtained online at
  189. http://www.opengroup.org/unix/online.html .
  190. .PP
  191. Any typographical or formatting errors that appear
  192. in this page are most likely
  193. to have been introduced during the conversion of the source files to
  194. man page format. To report such errors, see
  195. https://www.kernel.org/doc/man-pages/reporting_bugs.html .