2 .\" Copyright (c) 1994, Henrik Vestergaard Draboel
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by Henrik Vestergaard Draboel.
16 .\" 4. The name of the author may not be used to endorse or promote products
17 .\" derived from this software without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" Copyright (c) 2011 Xin LI <delphij@FreeBSD.org>
32 .\" All rights reserved.
34 .\" Redistribution and use in source and binary forms, with or without
35 .\" modification, are permitted provided that the following conditions
37 .\" 1. Redistributions of source code must retain the above copyright
38 .\" notice, this list of conditions and the following disclaimer.
39 .\" 2. Redistributions in binary form must reproduce the above copyright
40 .\" notice, this list of conditions and the following disclaimer in the
41 .\" documentation and/or other materials provided with the distribution.
43 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
44 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
47 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 .Nd examine or modify realtime or idle priority
70 .Fn rtprio "int function" "pid_t pid" "struct rtprio *rtp"
72 .Fn rtprio_thread "int function" "lwpid_t lwpid" "struct rtprio *rtp"
77 is used to lookup or change the realtime or idle priority of a process,
78 or the calling thread.
82 is used to lookup or change the realtime or idle priority of a thread.
87 specifies the operation to be performed.
88 RTP_LOOKUP to lookup the current priority,
89 and RTP_SET to set the priority.
97 specifies the process to operate on,
98 0 for the calling thread.
102 the system call reports the highest priority in the process,
103 or sets all threads' priority in the process,
104 depending on value of the
113 specifies the thread to operate on,
114 0 for the calling thread.
119 is a pointer to a struct rtprio which is used to specify the priority and priority type.
120 This structure has the following form:
130 field may be RTP_PRIO_REALTIME for realtime priorities,
131 RTP_PRIO_NORMAL for normal priorities, and RTP_PRIO_IDLE for idle priorities.
132 The priority specified by the
134 field ranges between 0 and
137 0 is the highest possible priority.
139 Realtime and idle priority is inherited through fork() and exec().
141 A realtime thread can only be preempted by a thread of equal or
142 higher priority, or by an interrupt; idle priority threads will run only
143 when no other real/normal priority thread is runnable.
144 Higher real/idle priority threads
145 preempt lower real/idle priority threads.
146 Threads of equal real/idle priority are run round-robin.
148 .Rv -std rtprio rtprio_thread
158 The rtp pointer passed to
168 The calling thread is not allowed to set the realtime priority.
170 root is allowed to change the realtime priority of any thread, and non-root
171 may only change the idle priority of threads the user owns,
175 .Va security.bsd.unprivileged_idprio
178 The specified process or thread was not found or visible.
190 The original author was
191 .An Henrik Vestergaard Draboel Aq Mt hvd@terry.ping.dk .
192 This implementation in
194 was substantially rewritten by
198 system call was implemented by