Blame man-pages-posix-2013-a/man3p/pthread_getschedparam.3p

Packit 7cfc04
'\" et
Packit 7cfc04
.TH PTHREAD_GETSCHEDPARAM "3P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
Packit 7cfc04
.SH PROLOG
Packit 7cfc04
This manual page is part of the POSIX Programmer's Manual.
Packit 7cfc04
The Linux implementation of this interface may differ (consult
Packit 7cfc04
the corresponding Linux manual page for details of Linux behavior),
Packit 7cfc04
or the interface may not be implemented on Linux.
Packit 7cfc04
Packit 7cfc04
.SH NAME
Packit 7cfc04
pthread_getschedparam,
Packit 7cfc04
pthread_setschedparam
Packit 7cfc04
\(em dynamic thread scheduling parameters access
Packit 7cfc04
(\fBREALTIME THREADS\fP)
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.LP
Packit 7cfc04
.nf
Packit 7cfc04
#include <pthread.h>
Packit 7cfc04
.P
Packit 7cfc04
int pthread_getschedparam(pthread_t \fIthread\fP, int *restrict \fIpolicy\fP,
Packit 7cfc04
    struct sched_param *restrict \fIparam\fP);
Packit 7cfc04
int pthread_setschedparam(pthread_t \fIthread\fP, int \fIpolicy\fP,
Packit 7cfc04
    const struct sched_param *\fIparam\fP);
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
\fIpthread_getschedparam\fR()
Packit 7cfc04
and
Packit 7cfc04
\fIpthread_setschedparam\fR()
Packit 7cfc04
functions shall, respectively, get and set the scheduling policy and
Packit 7cfc04
parameters of individual threads within a multi-threaded process to be
Packit 7cfc04
retrieved and set. For SCHED_FIFO and SCHED_RR,
Packit 7cfc04
the only required member of the
Packit 7cfc04
.BR sched_param
Packit 7cfc04
structure is the priority
Packit 7cfc04
.IR sched_priority .
Packit 7cfc04
For SCHED_OTHER,
Packit 7cfc04
the affected scheduling parameters are implementation-defined.
Packit 7cfc04
.P
Packit 7cfc04
The
Packit 7cfc04
\fIpthread_getschedparam\fR()
Packit 7cfc04
function shall retrieve the scheduling policy and scheduling parameters
Packit 7cfc04
for the thread whose thread ID is given by
Packit 7cfc04
.IR thread
Packit 7cfc04
and shall store those values in
Packit 7cfc04
.IR policy
Packit 7cfc04
and
Packit 7cfc04
.IR param ,
Packit 7cfc04
respectively. The priority value returned from
Packit 7cfc04
\fIpthread_getschedparam\fR()
Packit 7cfc04
shall be the value specified by the most recent
Packit 7cfc04
\fIpthread_setschedparam\fR(),
Packit 7cfc04
\fIpthread_setschedprio\fR(),
Packit 7cfc04
or
Packit 7cfc04
\fIpthread_create\fR()
Packit 7cfc04
call affecting the target thread. It shall not reflect any temporary
Packit 7cfc04
adjustments to its priority as a result of any priority inheritance or
Packit 7cfc04
ceiling functions. The
Packit 7cfc04
\fIpthread_setschedparam\fR()
Packit 7cfc04
function shall set the scheduling policy and associated scheduling
Packit 7cfc04
parameters for the thread whose thread ID is given by
Packit 7cfc04
.IR thread
Packit 7cfc04
to the policy and associated parameters provided in
Packit 7cfc04
.IR policy
Packit 7cfc04
and
Packit 7cfc04
.IR param ,
Packit 7cfc04
respectively.
Packit 7cfc04
.P
Packit 7cfc04
The
Packit 7cfc04
.IR policy
Packit 7cfc04
parameter may have the value SCHED_OTHER, SCHED_FIFO, or SCHED_RR. The
Packit 7cfc04
scheduling parameters for the SCHED_OTHER policy are
Packit 7cfc04
implementation-defined. The SCHED_FIFO and SCHED_RR policies shall
Packit 7cfc04
have a single scheduling parameter,
Packit 7cfc04
.IR priority .
Packit 7cfc04
.P
Packit 7cfc04
If _POSIX_THREAD_SPORADIC_SERVER is defined, then the
Packit 7cfc04
.IR policy
Packit 7cfc04
argument may have the value SCHED_SPORADIC, with the exception for the
Packit 7cfc04
\fIpthread_setschedparam\fR()
Packit 7cfc04
function that if the scheduling policy was not SCHED_SPORADIC at the
Packit 7cfc04
time of the call, it is implementation-defined whether the function
Packit 7cfc04
is supported; in other words, the implementation need not allow the
Packit 7cfc04
application to dynamically change the scheduling policy to
Packit 7cfc04
SCHED_SPORADIC. The sporadic server scheduling policy has the
Packit 7cfc04
associated parameters
Packit 7cfc04
.IR sched_ss_low_priority ,
Packit 7cfc04
.IR sched_ss_repl_period ,
Packit 7cfc04
.IR sched_ss_init_budget ,
Packit 7cfc04
.IR sched_priority ,
Packit 7cfc04
and
Packit 7cfc04
.IR sched_ss_max_repl .
Packit 7cfc04
The specified
Packit 7cfc04
.IR sched_ss_repl_period
Packit 7cfc04
shall be greater than or equal to the specified
Packit 7cfc04
.IR sched_ss_init_budget
Packit 7cfc04
for the function to succeed; if it is not, then the function shall
Packit 7cfc04
fail. The value of
Packit 7cfc04
.IR sched_ss_max_repl
Packit 7cfc04
shall be within the inclusive range [1,\c
Packit 7cfc04
{SS_REPL_MAX}]
Packit 7cfc04
for the function to succeed; if not, the function shall fail.
Packit 7cfc04
It is unspecified whether the
Packit 7cfc04
.IR sched_ss_repl_period
Packit 7cfc04
and
Packit 7cfc04
.IR sched_ss_init_budget
Packit 7cfc04
values are stored as provided by this function or are rounded to
Packit 7cfc04
align with the resolution of the clock being used.
Packit 7cfc04
.P
Packit 7cfc04
If the
Packit 7cfc04
\fIpthread_setschedparam\fR()
Packit 7cfc04
function fails, the scheduling parameters shall not be changed
Packit 7cfc04
for the target thread.
Packit 7cfc04
.SH "RETURN VALUE"
Packit 7cfc04
If successful, the
Packit 7cfc04
\fIpthread_getschedparam\fR()
Packit 7cfc04
and
Packit 7cfc04
\fIpthread_setschedparam\fR()
Packit 7cfc04
functions shall return zero; otherwise, an error number shall be
Packit 7cfc04
returned to indicate the error.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
The
Packit 7cfc04
\fIpthread_setschedparam\fR()
Packit 7cfc04
function shall fail if:
Packit 7cfc04
.TP
Packit 7cfc04
.BR ENOTSUP
Packit 7cfc04
An attempt was made to set the policy or scheduling parameters to an
Packit 7cfc04
unsupported value.
Packit 7cfc04
.TP
Packit 7cfc04
.BR ENOTSUP
Packit 7cfc04
An attempt was made to dynamically change the scheduling policy to
Packit 7cfc04
SCHED_SPORADIC, and the implementation does not support this change.
Packit 7cfc04
.P
Packit 7cfc04
The
Packit 7cfc04
\fIpthread_setschedparam\fR()
Packit 7cfc04
function may fail if:
Packit 7cfc04
.TP
Packit 7cfc04
.BR EINVAL
Packit 7cfc04
The value specified by
Packit 7cfc04
.IR policy
Packit 7cfc04
or one of the scheduling parameters associated with the scheduling
Packit 7cfc04
policy
Packit 7cfc04
.IR policy
Packit 7cfc04
is invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.BR EPERM
Packit 7cfc04
The caller does not have appropriate privileges to set either the
Packit 7cfc04
scheduling parameters or the scheduling policy of the specified
Packit 7cfc04
thread.
Packit 7cfc04
.TP
Packit 7cfc04
.BR EPERM
Packit 7cfc04
The implementation does not allow the application to modify
Packit 7cfc04
one of the parameters to the value specified.
Packit 7cfc04
.P
Packit 7cfc04
These functions shall not return an error code of
Packit 7cfc04
.BR [EINTR] .
Packit 7cfc04
.LP
Packit 7cfc04
.IR "The following sections are informative."
Packit 7cfc04
.SH EXAMPLES
Packit 7cfc04
None.
Packit 7cfc04
.SH "APPLICATION USAGE"
Packit 7cfc04
None.
Packit 7cfc04
.SH RATIONALE
Packit 7cfc04
If an implementation detects use of a thread ID after the end of its
Packit 7cfc04
lifetime, it is recommended that the function should fail and report an
Packit 7cfc04
.BR [ESRCH] 
Packit 7cfc04
error.
Packit 7cfc04
.SH "FUTURE DIRECTIONS"
Packit 7cfc04
None.
Packit 7cfc04
.SH "SEE ALSO"
Packit 7cfc04
.IR "\fIpthread_setschedprio\fR\^(\|)",
Packit 7cfc04
.IR "\fIsched_getparam\fR\^(\|)",
Packit 7cfc04
.IR "\fIsched_getscheduler\fR\^(\|)"
Packit 7cfc04
.P
Packit 7cfc04
The Base Definitions volume of POSIX.1\(hy2008,
Packit 7cfc04
.IR "\fB<pthread.h>\fP",
Packit 7cfc04
.IR "\fB<sched.h>\fP"
Packit 7cfc04
.SH COPYRIGHT
Packit 7cfc04
Portions of this text are reprinted and reproduced in electronic form
Packit 7cfc04
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
Packit 7cfc04
-- Portable Operating System Interface (POSIX), The Open Group Base
Packit 7cfc04
Specifications Issue 7, Copyright (C) 2013 by the Institute of
Packit 7cfc04
Electrical and Electronics Engineers, Inc and The Open Group.
Packit 7cfc04
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
Packit 7cfc04
event of any discrepancy between this version and the original IEEE and
Packit 7cfc04
The Open Group Standard, the original IEEE and The Open Group Standard
Packit 7cfc04
is the referee document. The original Standard can be obtained online at
Packit 7cfc04
http://www.unix.org/online.html .
Packit 7cfc04
Packit 7cfc04
Any typographical or formatting errors that appear
Packit 7cfc04
in this page are most likely
Packit 7cfc04
to have been introduced during the conversion of the source files to
Packit 7cfc04
man page format. To report such errors, see
Packit 7cfc04
https://www.kernel.org/doc/man-pages/reporting_bugs.html .