man-pages/man2/sched_setparam.2.html
2021-03-31 01:06:50 +01:00

205 lines
5.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SCHED_SETPARAM</TITLE>
</HEAD><BODY>
<H1>SCHED_SETPARAM</H1>
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-10-10<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
sched_setparam, sched_getparam - set and get scheduling parameters
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/sched.h">sched.h</A>&gt;</B>
<B>int sched_setparam(pid_t </B><I>pid</I><B>, const struct sched_param *</B><I>param</I><B>);</B>
<B>int sched_getparam(pid_t </B><I>pid</I><B>, struct sched_param *</B><I>param</I><B>);</B>
<B>struct sched_param {
...
int </B><I>sched_priority</I><B>;
...
};
</B></PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>sched_setparam</B>()
sets the scheduling parameters associated with the scheduling policy
for the thread whose thread ID is specified in <I>pid</I>.
If <I>pid</I> is zero, then
the parameters of the calling thread are set.
The interpretation of
the argument <I>param</I> depends on the scheduling
policy of the thread identified by
<I>pid</I>.
See
<B><A HREF="/cgi-bin/man/man2html?7+sched">sched</A></B>(7)
for a description of the scheduling policies supported under Linux.
<P>
<B>sched_getparam</B>()
retrieves the scheduling parameters for the
thread identified by <I>pid</I>.
If <I>pid</I> is zero, then the parameters
of the calling thread are retrieved.
<P>
<B>sched_setparam</B>()
checks the validity of <I>param</I> for the scheduling policy of the
thread.
The value <I>param-&gt;sched_priority</I> must lie within the
range given by
<B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_min">sched_get_priority_min</A></B>(2)
and
<B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_max">sched_get_priority_max</A></B>(2).
<P>
For a discussion of the privileges and resource limits related to
scheduling priority and policy, see
<B><A HREF="/cgi-bin/man/man2html?7+sched">sched</A></B>(7).
<P>
POSIX systems on which
<B>sched_setparam</B>()
and
<B>sched_getparam</B>()
are available define
<B>_POSIX_PRIORITY_SCHEDULING</B>
in <I>&lt;<A HREF="file:///usr/include/unistd.h">unistd.h</A>&gt;</I>.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success,
<B>sched_setparam</B>()
and
<B>sched_getparam</B>()
return 0.
On error, -1 is returned, and
<I>errno</I>
is set appropriately.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="1"><B>EINVAL</B>
<DD>
Invalid arguments:
<I>param</I>
is NULL or
<I>pid</I>
is negative
<DT id="2"><B>EINVAL</B>
<DD>
(<B>sched_setparam</B>())
The argument <I>param</I> does not make sense for the current
scheduling policy.
<DT id="3"><B>EPERM</B>
<DD>
(<B>sched_setparam</B>())
The caller does not have appropriate privileges
(Linux: does not have the
<B>CAP_SYS_NICE</B>
capability).
<DT id="4"><B>ESRCH</B>
<DD>
The thread whose ID is <I>pid</I> could not be found.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>CONFORMING TO</H2>
POSIX.1-2001, POSIX.1-2008.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+getpriority">getpriority</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+gettid">gettid</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+nice">nice</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_max">sched_get_priority_max</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_min">sched_get_priority_min</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sched_getaffinity">sched_getaffinity</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sched_getscheduler">sched_getscheduler</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sched_setaffinity">sched_setaffinity</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sched_setscheduler">sched_setscheduler</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+setpriority">setpriority</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?7+capabilities">capabilities</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+sched">sched</A></B>(7)
<A NAME="lbAI">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="8"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="9"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="10"><A HREF="#lbAG">CONFORMING TO</A><DD>
<DT id="11"><A HREF="#lbAH">SEE ALSO</A><DD>
<DT id="12"><A HREF="#lbAI">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:34 GMT, March 31, 2021
</BODY>
</HTML>