]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/sched_setparam.2
sched_setattr.2: tfix
[thirdparty/man-pages.git] / man2 / sched_setparam.2
CommitLineData
fea681da
MK
1.\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
2.\"
1dd72f9c 3.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
fea681da
MK
4.\" This is free documentation; you can redistribute it and/or
5.\" modify it under the terms of the GNU General Public License as
6.\" published by the Free Software Foundation; either version 2 of
7.\" the License, or (at your option) any later version.
8.\"
9.\" The GNU General Public License's references to "object code"
10.\" and "executables" are to be interpreted as the output of any
11.\" document formatting or typesetting system, including
12.\" intermediate and printed output.
13.\"
14.\" This manual is distributed in the hope that it will be useful,
15.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17.\" GNU General Public License for more details.
18.\"
19.\" You should have received a copy of the GNU General Public
c715f741
MK
20.\" License along with this manual; if not, see
21.\" <http://www.gnu.org/licenses/>.
6a8d8745 22.\" %%%LICENSE_END
fea681da
MK
23.\"
24.\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
25.\" First version written
26.\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
27.\" revision
c11b1abf 28.\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 29.\"
867c9b34 30.TH SCHED_SETPARAM 2 2019-10-10 "Linux" "Linux Programmer's Manual"
fea681da
MK
31.SH NAME
32sched_setparam, sched_getparam \- set and get scheduling parameters
33.SH SYNOPSIS
92c37d8c 34.nf
fea681da 35.B #include <sched.h>
68e4db0a 36.PP
c307030c 37.BI "int sched_setparam(pid_t " pid ", const struct sched_param *" param );
68e4db0a 38.PP
c307030c 39.BI "int sched_getparam(pid_t " pid ", struct sched_param *" param );
68e4db0a 40.PP
fea681da 41\fBstruct sched_param {
92c37d8c
MK
42 ...
43 int \fIsched_priority\fB;
44 ...
fea681da 45};
fea681da
MK
46.fi
47.SH DESCRIPTION
e511ffb6 48.BR sched_setparam ()
fea681da 49sets the scheduling parameters associated with the scheduling policy
603a9fa5 50for the thread whose thread ID is specified in \fIpid\fP.
a8d55537 51If \fIpid\fP is zero, then
603a9fa5 52the parameters of the calling thread are set.
c13182ef 53The interpretation of
c4bb193f 54the argument \fIparam\fP depends on the scheduling
603a9fa5 55policy of the thread identified by
c13182ef
MK
56.IR pid .
57See
515fc146 58.BR sched (7)
92c37d8c 59for a description of the scheduling policies supported under Linux.
efeece04 60.PP
e511ffb6 61.BR sched_getparam ()
c13182ef 62retrieves the scheduling parameters for the
603a9fa5 63thread identified by \fIpid\fP.
a8d55537 64If \fIpid\fP is zero, then the parameters
603a9fa5 65of the calling thread are retrieved.
efeece04 66.PP
e511ffb6 67.BR sched_setparam ()
a8d55537 68checks the validity of \fIparam\fP for the scheduling policy of the
fd524ab9 69thread.
49b71669 70The value \fIparam\->sched_priority\fP must lie within the
60a90ecd
MK
71range given by
72.BR sched_get_priority_min (2)
73and
74.BR sched_get_priority_max (2).
efeece04 75.PP
c13182ef 76For a discussion of the privileges and resource limits related to
0fdbc1eb 77scheduling priority and policy, see
515fc146 78.BR sched (7).
efeece04 79.PP
fea681da 80POSIX systems on which
e511ffb6 81.BR sched_setparam ()
fea681da 82and
e511ffb6 83.BR sched_getparam ()
fea681da 84are available define
f25eaea8 85.B _POSIX_PRIORITY_SCHEDULING
c84371c6 86in \fI<unistd.h>\fP.
47297adb 87.SH RETURN VALUE
fea681da 88On success,
e511ffb6 89.BR sched_setparam ()
fea681da 90and
e511ffb6 91.BR sched_getparam ()
fea681da 92return 0.
92c37d8c 93On error, \-1 is returned, and
fea681da
MK
94.I errno
95is set appropriately.
96.SH ERRORS
97.TP
98.B EINVAL
7181635a
MK
99Invalid arguments:
100.I param
101is NULL or
102.I pid
103is negative
104.TP
105.B EINVAL
5529e47b 106.RB ( sched_setparam ())
c4bb193f 107The argument \fIparam\fP does not make sense for the current
fea681da
MK
108scheduling policy.
109.TP
110.B EPERM
5529e47b 111.RB ( sched_setparam ())
603a9fa5 112The caller does not have appropriate privileges
0fdbc1eb
MK
113(Linux: does not have the
114.B CAP_SYS_NICE
115capability).
fea681da
MK
116.TP
117.B ESRCH
603a9fa5 118The thread whose ID is \fIpid\fP could not be found.
47297adb 119.SH CONFORMING TO
842d1823 120POSIX.1-2001, POSIX.1-2008.
47297adb 121.SH SEE ALSO
ca8a0bd2
MK
122.ad l
123.nh
fea681da 124.BR getpriority (2),
27f942ad 125.BR gettid (2),
fea681da
MK
126.BR nice (2),
127.BR sched_get_priority_max (2),
128.BR sched_get_priority_min (2),
129.BR sched_getaffinity (2),
130.BR sched_getscheduler (2),
131.BR sched_setaffinity (2),
48ae5295 132.BR sched_setattr (2),
04fb2950 133.BR sched_setscheduler (2),
fea681da 134.BR setpriority (2),
515fc146
MK
135.BR capabilities (7),
136.BR sched (7)