]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - lib/libc/sys/rtprio.2
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / lib / libc / sys / rtprio.2
1 .\" Copyright (c) 1994, Henrik Vestergaard Draboel
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by Henrik Vestergaard Draboel.
15 .\" 4. The name of the author may not be used to endorse or promote products
16 .\"    derived from this software without specific prior written permission.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd July 23, 1994
33 .Dt RTPRIO 2
34 .Os
35 .Sh NAME
36 .Nm rtprio
37 .Nd examine or modify a process realtime or idle priority
38 .Sh LIBRARY
39 .Lb libc
40 .Sh SYNOPSIS
41 .In sys/types.h
42 .In sys/rtprio.h
43 .Ft int
44 .Fn rtprio "int function" "pid_t pid" "struct rtprio *rtp"
45 .Sh DESCRIPTION
46 The
47 .Fn rtprio
48 system call
49 is used to lookup or change the realtime or idle priority of a process.
50 .Pp
51 The
52 .Fa function
53 argument
54 specifies the operation to be performed.
55 RTP_LOOKUP to lookup the current priority,
56 and RTP_SET to set the priority.
57 The
58 .Fa pid
59 argument
60 specifies the process to be used, 0 for the current process.
61 .Pp
62 The
63 .Fa *rtp
64 argument
65 is a pointer to a struct rtprio which is used to specify the priority and priority type.
66 This structure has the following form:
67 .Bd -literal
68 struct rtprio {
69         u_short type;
70         u_short prio;
71 };
72 .Ed
73 .Pp
74 The value of the
75 .Va type
76 field may be RTP_PRIO_REALTIME for realtime priorities,
77 RTP_PRIO_NORMAL for normal priorities, and RTP_PRIO_IDLE for idle priorities.
78 The priority specified by the
79 .Va prio
80 field ranges between 0 and
81 .Dv RTP_PRIO_MAX
82 .Pq usually 31 .
83 0 is the highest possible priority.
84 .Pp
85 Realtime and idle priority is inherited through fork() and exec().
86 .Pp
87 A realtime process can only be preempted by a process of equal or
88 higher priority, or by an interrupt; idle priority processes will run only
89 when no other real/normal priority process is runnable.
90 Higher real/idle priority processes
91 preempt lower real/idle priority processes.
92 Processes of equal real/idle priority are run round-robin.
93 .Sh RETURN VALUES
94 .Rv -std rtprio
95 .Sh ERRORS
96 The
97 .Fn rtprio
98 system call
99 will fail if:
100 .Bl -tag -width Er
101 .It Bq Er EINVAL
102 The specified
103 .Fa prio
104 was out of range.
105 .It Bq Er EPERM
106 The calling process is not allowed to set the realtime priority.
107 Only
108 root is allowed to change the realtime priority of any process, and non-root
109 may only change the idle priority of the current process.
110 .It Bq Er ESRCH
111 The specified process was not found.
112 .El
113 .Sh SEE ALSO
114 .Xr nice 1 ,
115 .Xr ps 1 ,
116 .Xr rtprio 1 ,
117 .Xr setpriority 2 ,
118 .Xr nice 3 ,
119 .Xr renice 8
120 .Sh AUTHORS
121 .An -nosplit
122 The original author was
123 .An Henrik Vestergaard Draboel Aq hvd@terry.ping.dk .
124 This implementation in
125 .Fx
126 was substantially rewritten by
127 .An David Greenman .