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

sched_setscheduler.3p (5619B)


  1. '\" et
  2. .TH SCHED_SETSCHEDULER "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. sched_setscheduler
  12. \(em set scheduling policy and parameters
  13. (\fBREALTIME\fP)
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <sched.h>
  18. .P
  19. int sched_setscheduler(pid_t \fIpid\fP, int \fIpolicy\fP,
  20. const struct sched_param *\fIparam\fP);
  21. .fi
  22. .SH DESCRIPTION
  23. The
  24. \fIsched_setscheduler\fR()
  25. function shall set the scheduling policy and scheduling parameters
  26. of the process specified by
  27. .IR pid
  28. to
  29. .IR policy
  30. and the parameters specified in the
  31. .BR sched_param
  32. structure pointed to by
  33. .IR param ,
  34. respectively. The value of the
  35. .IR sched_priority
  36. member in the
  37. .BR sched_param
  38. structure shall be any integer within the inclusive priority range
  39. for the scheduling policy specified by
  40. .IR policy .
  41. If the value of
  42. .IR pid
  43. is negative, the behavior of the
  44. \fIsched_setscheduler\fR()
  45. function is unspecified.
  46. .P
  47. The possible values for the
  48. .IR policy
  49. parameter are defined in the
  50. .IR <sched.h>
  51. header.
  52. .P
  53. If a process specified by
  54. .IR pid
  55. exists, and if the calling process has permission, the scheduling
  56. policy and scheduling parameters shall be set for the process whose
  57. process ID is equal to
  58. .IR pid .
  59. .P
  60. If
  61. .IR pid
  62. is zero, the scheduling policy and scheduling parameters shall be
  63. set for the calling process.
  64. .P
  65. The conditions under which one process has appropriate privileges to
  66. change the scheduling parameters of another process are
  67. implementation-defined.
  68. .P
  69. Implementations may require that the requesting process have permission
  70. to set its own scheduling parameters or those of another process.
  71. Additionally, implementation-defined restrictions may apply as to the
  72. appropriate privileges required to set the scheduling
  73. policy of the process, or the scheduling policy of another process,
  74. to a particular value.
  75. .P
  76. The
  77. \fIsched_setscheduler\fR()
  78. function shall be considered successful if it succeeds in setting the
  79. scheduling policy and scheduling parameters of the process specified by
  80. .IR pid
  81. to the values specified by
  82. .IR policy
  83. and the structure pointed to by
  84. .IR param ,
  85. respectively.
  86. .P
  87. See
  88. .IR "Scheduling Policies"
  89. for a description on how this function affects the scheduling of the
  90. threads within the target process.
  91. .P
  92. If the current scheduling policy for the target process is not
  93. SCHED_FIFO, SCHED_RR,
  94. or SCHED_SPORADIC,
  95. the result is implementation-defined; this case includes the
  96. SCHED_OTHER policy.
  97. .P
  98. The specified
  99. .IR sched_ss_repl_period
  100. shall be greater than or equal to the specified
  101. .IR sched_ss_init_budget
  102. for the function to succeed; if it is not, then the function shall
  103. fail.
  104. .P
  105. The value of
  106. .IR sched_ss_max_repl
  107. shall be within the inclusive range [1,{SS_REPL_MAX}] for the function
  108. to succeed; if not, the function shall fail. It is unspecified whether the
  109. .IR sched_ss_repl_period
  110. and
  111. .IR sched_ss_init_budget
  112. values are stored as provided by this function or are rounded to
  113. align with the resolution of the clock being used.
  114. .P
  115. This function is not atomic with respect to other threads in the
  116. process. Threads may continue to execute while this function call is in
  117. the process of changing the scheduling policy and associated scheduling
  118. parameters for the underlying kernel-scheduled entities used by the
  119. process contention scope threads.
  120. .SH "RETURN VALUE"
  121. Upon successful completion, the function shall return the former
  122. scheduling policy of the specified process. If the
  123. \fIsched_setscheduler\fR()
  124. function fails to complete successfully, the policy and scheduling
  125. parameters shall remain unchanged, and the function shall return a
  126. value of \-1 and set
  127. .IR errno
  128. to indicate the error.
  129. .SH ERRORS
  130. The
  131. \fIsched_setscheduler\fR()
  132. function shall fail if:
  133. .TP
  134. .BR EINVAL
  135. The value of the
  136. .IR policy
  137. parameter is invalid, or one or more of the parameters contained in
  138. .IR param
  139. is outside the valid range for the specified scheduling policy.
  140. .TP
  141. .BR EPERM
  142. The requesting process does not have permission to set either or both
  143. of the scheduling parameters or the scheduling policy of the specified
  144. process.
  145. .TP
  146. .BR ESRCH
  147. No process can be found corresponding to that specified by
  148. .IR pid .
  149. .LP
  150. .IR "The following sections are informative."
  151. .SH EXAMPLES
  152. None.
  153. .SH "APPLICATION USAGE"
  154. None.
  155. .SH RATIONALE
  156. None.
  157. .SH "FUTURE DIRECTIONS"
  158. None.
  159. .SH "SEE ALSO"
  160. .IR "Scheduling Policies",
  161. .IR "\fIsched_getparam\fR\^(\|)",
  162. .IR "\fIsched_getscheduler\fR\^(\|)",
  163. .IR "\fIsched_setparam\fR\^(\|)"
  164. .P
  165. The Base Definitions volume of POSIX.1\(hy2017,
  166. .IR "\fB<sched.h>\fP"
  167. .\"
  168. .SH COPYRIGHT
  169. Portions of this text are reprinted and reproduced in electronic form
  170. from IEEE Std 1003.1-2017, Standard for Information Technology
  171. -- Portable Operating System Interface (POSIX), The Open Group Base
  172. Specifications Issue 7, 2018 Edition,
  173. Copyright (C) 2018 by the Institute of
  174. Electrical and Electronics Engineers, Inc and The Open Group.
  175. In the event of any discrepancy between this version and the original IEEE and
  176. The Open Group Standard, the original IEEE and The Open Group Standard
  177. is the referee document. The original Standard can be obtained online at
  178. http://www.opengroup.org/unix/online.html .
  179. .PP
  180. Any typographical or formatting errors that appear
  181. in this page are most likely
  182. to have been introduced during the conversion of the source files to
  183. man page format. To report such errors, see
  184. https://www.kernel.org/doc/man-pages/reporting_bugs.html .