1sched_setparam(3C) Standard C Library Functions sched_setparam(3C)
2
3
4
6 sched_setparam - set scheduling parameters
7
9 #include <sched.h>
10
11 int sched_setparam(pid_t pid, const struct sched_param *param);
12
13
15 The sched_setparam() function sets the scheduling parameters of the
16 process specified by pid to the values specified by the sched_param
17 structure pointed to by param. The value of the sched_priority member
18 in the sched_param structure is any integer within the inclusive prior‐
19 ity range for the current scheduling policy of the process specified by
20 pid. Higher numerical values for the priority represent higher priori‐
21 ties. If the value of pid is negative, the behavior of the sched_set‐
22 param() function is unspecified.
23
24
25 If a process specified by pid exists and if the calling process has
26 permission, the scheduling parameters will be set for the process whose
27 process ID is equal to pid. The real or effective user ID of the call‐
28 ing process must match the real or saved (from exec(2)) user ID of the
29 target process unless the effective user ID of the calling process is
30 0. See Intro(2).
31
32
33 If pid is zero, the scheduling parameters will be set for the calling
34 process.
35
36
37 The target process, whether it is running or not running, resumes exe‐
38 cution after all other runnable processes of equal or greater priority
39 have been scheduled to run.
40
41
42 If the priority of the process specified by the pid argument is set
43 higher than that of the lowest priority running process and if the
44 specified process is ready to run, the process specified by the pid
45 argument preempts a lowest priority running process. Similarly, if the
46 process calling sched_setparam() sets its own priority lower than that
47 of one or more other non-empty process lists, then the process that is
48 the head of the highest priority list also preempts the calling
49 process. Thus, in either case, the originating process might not
50 receive notification of the completion of the requested priority change
51 until the higher priority process has executed.
52
54 If successful, the sched_setparam() function returns 0.
55
56
57 If the call to sched_setparam() is unsuccessful, the priority remains
58 unchanged, and the function returns −1 and sets errno to indicate the
59 error.
60
62 The sched_setparam() function will fail if:
63
64 EINVAL One or more of the requested scheduling parameters is outside
65 the range defined for the scheduling policy of the specified
66 pid.
67
68
69 EPERM The requesting process does not have permission to set the
70 scheduling parameters for the specified process, or does not
71 have the appropriate privilege to invoke sched_setparam().
72
73
74 ESRCH No process can be found corresponding to that specified by
75 pid.
76
77
79 See attributes(5) for descriptions of the following attributes:
80
81
82
83
84 ┌─────────────────────────────┬─────────────────────────────┐
85 │ATTRIBUTE TYPE │ATTRIBUTE VALUE │
86 ├─────────────────────────────┼─────────────────────────────┤
87 │Interface Stability │Committed │
88 ├─────────────────────────────┼─────────────────────────────┤
89 │MT-Level │MT-Safe │
90 ├─────────────────────────────┼─────────────────────────────┤
91 │Standard │See standards(5). │
92 └─────────────────────────────┴─────────────────────────────┘
93
95 Intro(2), exec(2), librt(3LIB), sched.h(3HEAD), sched_getparam(3C),
96 sched_getscheduler(3C), sched_setscheduler(3C), attributes(5), stan‐
97 dards(5)
98
99
100
101SunOS 5.11 1 Apr 2008 sched_setparam(3C)