xref: /freebsd/share/man/man3/pthread_schedparam.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1c5e7e03aSRuslan Ermilov.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
24c089f4dSJason Evans.\" All rights reserved.
34c089f4dSJason Evans.\"
44c089f4dSJason Evans.\" Redistribution and use in source and binary forms, with or without
54c089f4dSJason Evans.\" modification, are permitted provided that the following conditions
64c089f4dSJason Evans.\" are met:
74c089f4dSJason Evans.\" 1. Redistributions of source code must retain the above copyright
84c089f4dSJason Evans.\"    notice(s), this list of conditions and the following disclaimer as
94c089f4dSJason Evans.\"    the first lines of this file unmodified other than the possible
104c089f4dSJason Evans.\"    addition of one or more copyright notices.
114c089f4dSJason Evans.\" 2. Redistributions in binary form must reproduce the above copyright
124c089f4dSJason Evans.\"    notice(s), this list of conditions and the following disclaimer in
134c089f4dSJason Evans.\"    the documentation and/or other materials provided with the
144c089f4dSJason Evans.\"    distribution.
154c089f4dSJason Evans.\"
164c089f4dSJason Evans.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
174c089f4dSJason Evans.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
184c089f4dSJason Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
194c089f4dSJason Evans.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
204c089f4dSJason Evans.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
214c089f4dSJason Evans.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
224c089f4dSJason Evans.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
234c089f4dSJason Evans.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
244c089f4dSJason Evans.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
254c089f4dSJason Evans.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
264c089f4dSJason Evans.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
274c089f4dSJason Evans.\"
28*04620006SMitchell Horne.Dd October 17, 2022
294c089f4dSJason Evans.Dt PTHREAD_SCHEDPARAM 3
304c089f4dSJason Evans.Os
314c089f4dSJason Evans.Sh NAME
322a53c5ecSAlexey Zelkin.Nm pthread_setschedparam ,
332a53c5ecSAlexey Zelkin.Nm pthread_getschedparam
344c089f4dSJason Evans.Nd thread scheduling parameter manipulation
354c089f4dSJason Evans.Sh LIBRARY
36ec7452f1SRuslan Ermilov.Lb libpthread
374c089f4dSJason Evans.Sh SYNOPSIS
3832eef9aeSRuslan Ermilov.In pthread.h
394c089f4dSJason Evans.Ft int
404c089f4dSJason Evans.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param"
414c089f4dSJason Evans.Ft int
42b6413b6dSPedro F. Giffuni.Fn pthread_getschedparam "pthread_t thread" "int *restrict policy" "struct sched_param *restrict param"
434c089f4dSJason Evans.Sh DESCRIPTION
444c089f4dSJason EvansThe
454c089f4dSJason Evans.Fn pthread_setschedparam
464c089f4dSJason Evansand
474c089f4dSJason Evans.Fn pthread_getschedparam
484c089f4dSJason Evansfunctions set and get the scheduling parameters of individual threads.
494c089f4dSJason EvansThe scheduling policy for a thread can either be
504c089f4dSJason Evans.Dv SCHED_FIFO
51a676ad7aSRuslan Ermilov(first in, first out),
524c089f4dSJason Evans.Dv SCHED_RR
53a676ad7aSRuslan Ermilov(round-robin), or
54a676ad7aSRuslan Ermilov.Dv SCHED_OTHER
55a676ad7aSRuslan Ermilov(timesharing).
56a676ad7aSRuslan ErmilovValid thread priorities (accessed via
574c089f4dSJason Evans.Va param->sched_priority )
58a676ad7aSRuslan Ermilovmust be within the range returned by the
59a676ad7aSRuslan Ermilov.Xr sched_get_priority_min 2
60a676ad7aSRuslan Ermilovand
61a676ad7aSRuslan Ermilov.Xr sched_get_priority_max 2
62a676ad7aSRuslan Ermilovsystem calls.
634c089f4dSJason Evans.Sh RETURN VALUES
644c089f4dSJason EvansIf successful, these functions return 0.
654c089f4dSJason EvansOtherwise, an error number is returned to indicate the error.
664c089f4dSJason Evans.Sh ERRORS
679d09157aSPhilippe CharnierThe
684c089f4dSJason Evans.Fn pthread_setschedparam
699d09157aSPhilippe Charnierfunction will fail if:
704c089f4dSJason Evans.Bl -tag -width Er
714c089f4dSJason Evans.It Bq Er EINVAL
724c089f4dSJason EvansInvalid value for
73a676ad7aSRuslan Ermilov.Fa policy .
744c089f4dSJason Evans.It Bq Er ENOTSUP
754c089f4dSJason EvansInvalid value for scheduling parameters.
76*04620006SMitchell Horne.It Bq Er EPERM
77*04620006SMitchell HorneThe calling thread does not have sufficient privilege to perform the operation.
784c089f4dSJason Evans.It Bq Er ESRCH
794c089f4dSJason EvansNon-existent thread
80a676ad7aSRuslan Ermilov.Fa thread .
814c089f4dSJason Evans.El
822a53c5ecSAlexey Zelkin.Pp
839d09157aSPhilippe CharnierThe
844c089f4dSJason Evans.Fn pthread_getschedparam
859d09157aSPhilippe Charnierfunction will fail if:
864c089f4dSJason Evans.Bl -tag -width Er
874c089f4dSJason Evans.It Bq Er ESRCH
884c089f4dSJason EvansNon-existent thread
89a676ad7aSRuslan Ermilov.Fa thread .
904c089f4dSJason Evans.El
91a676ad7aSRuslan Ermilov.Sh SEE ALSO
92a676ad7aSRuslan Ermilov.Xr sched_get_priority_max 2 ,
93a676ad7aSRuslan Ermilov.Xr sched_get_priority_min 2
944c089f4dSJason Evans.Sh STANDARDS
959d09157aSPhilippe CharnierThe
964c089f4dSJason Evans.Fn pthread_setschedparam
974c089f4dSJason Evansand
984c089f4dSJason Evans.Fn pthread_getschedparam
999d09157aSPhilippe Charnierfunctions conform to
100a676ad7aSRuslan Ermilov.St -susv2 .
101