Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

rtprio(2) [freebsd man page]

RTPRIO(2)						      BSD System Calls Manual							 RTPRIO(2)

NAME
rtprio, rtprio_thread -- examine or modify realtime or idle priority LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <sys/rtprio.h> int rtprio(int function, pid_t pid, struct rtprio *rtp); int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); DESCRIPTION
The rtprio() system call is used to lookup or change the realtime or idle priority of a process, or the calling thread. The rtprio_thread() system call is used to lookup or change the realtime or idle priority of a thread. 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 sys- tem call reports the highest priority in the process, or sets all threads' priority in the process, depending on value of the function argu- ment. 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 prior- ity. 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. RETURN VALUES
The rtprio() and rtprio_thread() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The rtprio() and rtprio_thread() system calls will fail if: [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 realtime priority. Only root is allowed to change the realtime priority of any thread, and non-root may only change the idle priority of threads the user owns, when the sysctl(8) variable security.bsd.unprivileged_idprio is set to non-zero. [ESRCH] The specified process or thread was not found or visible. SEE ALSO
nice(1), ps(1), rtprio(1), setpriority(2), nice(3), renice(8), p_cansee(9) AUTHORS
The original author was Henrik Vestergaard Draboel <hvd@terry.ping.dk>. This implementation in FreeBSD was substantially rewritten by David Greenman. The rtprio_thread() system call was implemented by David Xu. BSD
December 27, 2011 BSD

Check Out this Related Man Page

rtsched(1)						      General Commands Manual							rtsched(1)

NAME
rtsched - execute process/lightweight process (LWP) with real-time priority SYNOPSIS
scheduler priority command [arguments] scheduler] priority scheduler] priority scheduler] priority DESCRIPTION
executes command with POSIX or HP-UX real-time priority, or changes the real-time priority of currently executing process (pid) or light- weight process (lwpid). All POSIX real-time priority processes or LWPs are of greater scheduling importance than processes/LWPs with HP-UX real-time or HP-UX time- share priority. All HP-UX real-time priority processes/LWPs are of greater scheduling importance than HP-UX timeshare priority pro- cesses/LWPs, but are of lesser importance than POSIX real-time processes/LWPs. Neither POSIX nor HP-UX real-time processes/LWPs are subject to degradation. POSIX real-time processes/LWPs may be scheduled with one of three different POSIX real-time schedulers: SCHED_FIFO, SCHED_RR, or SCHED_RR2. See rtsched(2) for details. is a superset of See rtprio(1). Options Specify the desired scheduler: POSIX real-time schedulers: SCHED_FIFO SCHED_RR SCHED_RR2 HP-UX real-time scheduler: SCHED_RTPRIO HP-UX timeshare scheduler: SCHED_HPUX SCHED_NOAGE Specify priority range; any integer within the inclusive priority range of the corresponding scheduler. is required for all schedulers except SCHED_HPUX. If scheduler is SCHED_HPUX, the priority argument is ignored. The default priority range of each scheduler is as follows: scheduler highest priority lowest priority -------------------------------------------------- SCHED_FIFO 31 0 SCHED_RR 31 0 SCHED_RR2 31 0 SCHED_RTPRIO 0 127 SCHED_NOAGE 178 255 SCHED_HPUX N/A N/A Higher numerical values for the priority represent higher priorities under POSIX real-time schedulers, whereas lower numeri- cal values for the priority represent higher priorities under HP-UX real-time and timeshare schedulers. Specify an already executing process ID (pid). Specify an already executing lightweight process ID (lwpid). The target LWP (lwpid) can be in any process. Select all the LWPs in an already executing process (specified with When scheduling policy is not specified explicitly using the option, the process's current schedul- ing policy will be used. If the requested priority value is in the range for this scheduling policy, the scheduling policy and priority of the process and all its LWPs will be changed to these values. Please note that it may cause the scheduling policy to be changed for some LWPs. If the user is not a member of a group having access and is not the user with appropriate privileges, command is not scheduled, or pid's/ lwpid's real-time priority is not changed. When changing the real-time priority of a currently executing process/LWP, the effective user ID of the calling process must be the user with appropriate privileges, or the real or effective user ID must match the real or saved user ID of the process to be modified. In presence of processor sets (see pset_create(2) for details), the application execution is restricted to processors in the application's processor set. The threads in different processor sets do not compete with one another for processors based on their scheduling policy and priority values. The scheduler looks only at threads assigned to a processor's processor set to choose the next thread to run. RETURN VALUE
returns exit status: if command is successfully scheduled or if pid's or lwpid's real-time priority is successfully changed; if command is not executable, pid or lwpid does not exist, or priority is not within the priority range for the corresponding scheduler; if command (pid/lwpid) lacks real-time capability, or the invoker's effective user ID is not a user who has appropriate privi- leges, or the real or effective user or the real or effective user ID does not match the real or saved user ID of the process being changed; or if rtsched encountered an internal error or if rtsched is not supported by this release. EXAMPLES
Execute file with SCHED_FIFO at a priority of 10: Execute file with SCHED_RTPRIO at a priority of 127 (this is synonymous to Execute file with the SCHED_HPUX scheduler: This is useful to spawn a timeshare priority command from a real-time priority shell. Set the currently running process, pid 24217, to execute with SCHED_RR2 at a priority of 20: Now change its priority to 10 using the same scheduler: Set the currently running LWP, lwpid 987312, to execute with SCHED_RR at a priority of 10: Set all currently executing LWPs in a process pid 21342 to execute with SCHED_FIFO at a priority of 25: WARNINGS
The priority values used by may differ from those used by other commands. For example, ps(1) displays the internal representation of pri- ority values. AUTHOR
was developed by HP. SEE ALSO
rtprio(1), setprivgrp(1M), getprivgrp(2), pset_create(2), rtprio(2), rtsched(2), _lwp_getscheduler(2), _lwp_setscheduler(2), pstat_getlwp(2). rtsched(1)
Man Page