Main index | Section 2 | Options |
#include <sys/types.h>
#include <sys/rtprio.h>
The function argument specifies the operation to be performed. RTP_LOOKUP to lookup the current priority, and RTP_SET to set the priority.
For the rtprio() system call, the pid argument specifies the process to operate on, 0 for the calling thread. When pid is non-zero, the system call reports the highest priority in the process, or sets all threads' priority in the process, depending on value of the function argument.
For the rtprio_thread() system call, the lwpid specifies the thread to operate on, 0 for the calling thread.
The *rtp argument is a pointer to a struct rtprio which is used to specify the priority and priority type. This structure has the following form:
struct rtprio { u_short type; u_short prio; };
The value of the type field may be RTP_PRIO_REALTIME for realtime priorities, RTP_PRIO_NORMAL for normal priorities, and RTP_PRIO_IDLE for idle priorities. The priority specified by the prio field ranges between 0 and RTP_PRIO_MAX (usually 31). 0 is the highest possible priority.
Realtime and idle priority is inherited through fork() and exec().
A realtime thread can only be preempted by a thread of equal or higher priority, or by an interrupt; idle priority threads will run only when no other real/normal priority thread is runnable. Higher real/idle priority threads preempt lower real/idle priority threads. Threads of equal real/idle priority are run round-robin.
[EFAULT] | |
The rtp pointer passed to rtprio() or rtprio_thread() was invalid. | |
[EINVAL] | |
The specified prio was out of range. | |
[EPERM] | |
The calling thread is not allowed to set the priority. Only root is allowed to change the realtime or idle priority of any thread. Exceptional privileges can be granted through the mac_priority(4) policy and the realtime and idletime user groups. The sysctl(8) variable security.bsd.unprivileged_idprio is deprecated. If set to non-zero, it lets any user change the idle priority of threads they own. | |
[ESRCH] | |
The specified process or thread was not found or visible. | |
RTPRIO (2) | December 8, 2021 |
Main index | Section 2 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what's wrong.” | ” |