OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man2 / sched_setparam.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
4 .\"
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" USA.
24 .\"
25 .\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
26 .\"            First version written
27 .\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
28 .\"            revision
29 .\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
30 .\"
31 .TH SCHED_SETPARAM 2 2006-03-23 "Linux" "Linux Programmer's Manual"
32 .SH NAME
33 sched_setparam, sched_getparam \- set and get scheduling parameters
34 .SH SYNOPSIS
35 .nf
36 .B #include <sched.h>
37 .sp
38 .BI "int sched_setparam(pid_t " pid ", const struct sched_param *" param );
39 .sp
40 .BI "int sched_getparam(pid_t " pid ", struct sched_param *" param );
41 .sp
42 \fBstruct sched_param {
43     ...
44     int \fIsched_priority\fB;
45     ...
46 };
47 .fi
48 .SH DESCRIPTION
49 .BR sched_setparam ()
50 sets the scheduling parameters associated with the scheduling policy
51 for the process identified by \fIpid\fP.
52 If \fIpid\fP is zero, then
53 the parameters of the calling process are set.
54 The interpretation of
55 the argument \fIparam\fP depends on the scheduling
56 policy of the process identified by
57 .IR pid .
58 See
59 .BR sched_setscheduler (2)
60 for a description of the scheduling policies supported under Linux.
61
62 .BR sched_getparam ()
63 retrieves the scheduling parameters for the
64 process identified by \fIpid\fP.
65 If \fIpid\fP is zero, then the parameters
66 of the calling process are retrieved.
67
68 .BR sched_setparam ()
69 checks the validity of \fIparam\fP for the scheduling policy of the
70 process.
71 The value \fIparam\->sched_priority\fP must lie within the
72 range given by
73 .BR sched_get_priority_min (2)
74 and
75 .BR sched_get_priority_max (2).
76
77 For a discussion of the privileges and resource limits related to
78 scheduling priority and policy, see
79 .BR sched_setscheduler (2).
80
81 POSIX systems on which
82 .BR sched_setparam ()
83 and
84 .BR sched_getparam ()
85 are available define
86 .B _POSIX_PRIORITY_SCHEDULING
87 in \fI<unistd.h>\fP.
88 .SH "RETURN VALUE"
89 On success,
90 .BR sched_setparam ()
91 and
92 .BR sched_getparam ()
93 return 0.
94 On error, \-1 is returned, and
95 .I errno
96 is set appropriately.
97 .SH ERRORS
98 .TP
99 .B EINVAL
100 The argument \fIparam\fP does not make sense for the current
101 scheduling policy.
102 .TP
103 .B EPERM
104 The calling process does not have appropriate privileges
105 (Linux: does not have the
106 .B CAP_SYS_NICE
107 capability).
108 .TP
109 .B ESRCH
110 The process whose ID is \fIpid\fP could not be found.
111 .SH "CONFORMING TO"
112 POSIX.1-2001.
113 .SH "SEE ALSO"
114 .BR getpriority (2),
115 .BR nice (2),
116 .BR sched_get_priority_max (2),
117 .BR sched_get_priority_min (2),
118 .BR sched_getaffinity (2),
119 .BR sched_getscheduler (2),
120 .BR sched_setaffinity (2),
121 .BR sched_setscheduler (2),
122 .BR setpriority (2),
123 .BR capabilities (7)
124 .PP
125 .I Programming for the real world \- POSIX.4
126 by Bill O. Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0