-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
.\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
.\"
+.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
-.\" License along with this manual; if not, write to the Free
-.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
-.\" USA.
+.\" License along with this manual; if not, see
+.\" <http://www.gnu.org/licenses/>.
+.\" %%%LICENSE_END
.\"
.\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
.\" First version written
.\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
.\" revision
-.\" Modified 2004-05-27 by Michael Kerrisk <mtk16@ext.canterbury.ac.nz>
+.\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
-.TH SCHED_SETPARAM 2 2004-05-27 "Linux 2.6.6" "Linux Programmer's Manual"
+.TH SCHED_SETPARAM 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.SH NAME
sched_setparam, sched_getparam \- set and get scheduling parameters
.SH SYNOPSIS
-.B #include <sched.h>
-.sp
-\fBint sched_setparam(pid_t \fIpid\fB, const struct sched_param *\fIp\fB);
-.sp
-\fBint sched_getparam(pid_t \fIpid\fB, struct sched_param *\fIp\fB);
-.sp
.nf
-.ta 4n
+.B #include <sched.h>
+.PP
+.BI "int sched_setparam(pid_t " pid ", const struct sched_param *" param );
+.PP
+.BI "int sched_getparam(pid_t " pid ", struct sched_param *" param );
+.PP
\fBstruct sched_param {
- ...
- int \fIsched_priority\fB;
- ...
+ ...
+ int \fIsched_priority\fB;
+ ...
};
-.ta
.fi
.SH DESCRIPTION
-.B sched_setparam
+.BR sched_setparam ()
sets the scheduling parameters associated with the scheduling policy
-for the process identified by \fIpid\fR. If \fIpid\fR is zero, then
-the parameters of the current process are set. The interpretation of
-the parameter \fIp\fR depends on the selected policy. Currently, the
-following three scheduling policies are supported under Linux:
-.IR SCHED_FIFO ,
-.IR SCHED_RR ,
-and
-.IR SCHED_OTHER.
-
-.B sched_getparam
-retrieves the scheduling parameters for the
-process identified by \fIpid\fR. If \fIpid\fR is zero, then the parameters
-of the current process are retrieved.
-
-.B sched_setparam
-checks the validity of \fIp\fR for the scheduling policy of the
-process. The parameter \fIp->sched_priority\fR must lie within the
-range given by \fBsched_get_priority_min\fR and
-\fBsched_get_priority_max\fR.
-
+for the thread whose thread ID is specified in \fIpid\fP.
+If \fIpid\fP is zero, then
+the parameters of the calling thread are set.
+The interpretation of
+the argument \fIparam\fP depends on the scheduling
+policy of the thread identified by
+.IR pid .
+See
+.BR sched (7)
+for a description of the scheduling policies supported under Linux.
+.PP
+.BR sched_getparam ()
+retrieves the scheduling parameters for the
+thread identified by \fIpid\fP.
+If \fIpid\fP is zero, then the parameters
+of the calling thread are retrieved.
+.PP
+.BR sched_setparam ()
+checks the validity of \fIparam\fP for the scheduling policy of the
+thread.
+The value \fIparam\->sched_priority\fP must lie within the
+range given by
+.BR sched_get_priority_min (2)
+and
+.BR sched_get_priority_max (2).
+.PP
+For a discussion of the privileges and resource limits related to
+scheduling priority and policy, see
+.BR sched (7).
+.PP
POSIX systems on which
-.B sched_setparam
+.BR sched_setparam ()
and
-.B sched_getparam
+.BR sched_getparam ()
are available define
-.I _POSIX_PRIORITY_SCHEDULING
-in <unistd.h>.
-
-.SH "RETURN VALUE"
+.B _POSIX_PRIORITY_SCHEDULING
+in \fI<unistd.h>\fP.
+.SH RETURN VALUE
On success,
-.BR sched_setparam
+.BR sched_setparam ()
and
-.BR sched_getparam
+.BR sched_getparam ()
return 0.
-On error, \-1 is returned,
+On error, \-1 is returned, and
.I errno
is set appropriately.
.SH ERRORS
.TP
.B EINVAL
-The parameter \fIp\fR does not make sense for the current
+Invalid arguments:
+.I param
+is NULL or
+.I pid
+is negative
+.TP
+.B EINVAL
+.RB ( sched_setparam ())
+The argument \fIparam\fP does not make sense for the current
scheduling policy.
.TP
.B EPERM
-The calling process does not have appropriate privileges.
-A process calling
-.BR sched_setparam
-needs an effective user ID equal to the user ID or effective user ID
-of the process identified by
-.IR pid ,
-or (Linux) it must have the
-CAP_SYS_NICE
-capability.
+.RB ( sched_setparam ())
+The caller does not have appropriate privileges
+(Linux: does not have the
+.B CAP_SYS_NICE
+capability).
.TP
.B ESRCH
-The process whose ID is \fIpid\fR could not be found.
-.SH "CONFORMING TO"
-POSIX.1b (formerly POSIX.4)
-.SH "SEE ALSO"
+The thread whose ID is \fIpid\fP could not be found.
+.SH CONFORMING TO
+POSIX.1-2001, POSIX.1-2008.
+.SH SEE ALSO
+.ad l
+.nh
+.BR gettid (2),
.BR getpriority (2),
.BR nice (2),
.BR sched_get_priority_max (2),
.BR sched_getaffinity (2),
.BR sched_getscheduler (2),
.BR sched_setaffinity (2),
+.BR sched_setattr (2),
.BR sched_setscheduler (2),
.BR setpriority (2),
-.BR capabilities (7)
-.PP
-.BR sched_setscheduler (2)
-has a description of the Linux scheduling scheme.
-.PP
-.I Programming for the real world \- POSIX.4
-by Bill O. Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0
-.br
-.I IEEE Std 1003.1b-1993
-(POSIX.1b standard)
-.br
-.I ISO/IEC 9945-1:1996
+.BR capabilities (7),
+.BR sched (7)