1994-09-01 09:52:37 +00:00
|
|
|
.\" Copyright (c) 1994, Henrik Vestergaard Draboel
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
1995-08-05 07:31:19 +00:00
|
|
|
.\" This product includes software developed by Henrik Vestergaard Draboel.
|
1994-09-01 09:52:37 +00:00
|
|
|
.\" 4. The name of the author may not be used to endorse or promote products
|
|
|
|
.\" derived from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1994-09-01 09:52:37 +00:00
|
|
|
.\"
|
|
|
|
.Dd July 23, 1994
|
|
|
|
.Dt RTPRIO 2
|
|
|
|
.Sh NAME
|
|
|
|
.Nm rtprio
|
1995-08-05 07:31:19 +00:00
|
|
|
.Nd examine or modify a process realtime or idle priority
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
1994-09-01 09:52:37 +00:00
|
|
|
.Sh SYNOPSIS
|
1996-05-01 01:18:43 +00:00
|
|
|
.Fd #include <sys/types.h>
|
1995-08-05 07:31:19 +00:00
|
|
|
.Fd #include <sys/rtprio.h>
|
1994-09-01 09:52:37 +00:00
|
|
|
.Ft int
|
1996-05-01 01:18:43 +00:00
|
|
|
.Fn rtprio "int function" "pid_t pid" "struct rtprio *rtp"
|
1994-09-01 09:52:37 +00:00
|
|
|
.Sh DESCRIPTION
|
1995-08-05 07:31:19 +00:00
|
|
|
.Fn rtprio
|
|
|
|
is used to lookup or change the realtime or idle priority of a process.
|
2000-06-23 20:35:45 +00:00
|
|
|
.Pp
|
1995-08-05 07:31:19 +00:00
|
|
|
.Fa function
|
2000-03-02 09:14:21 +00:00
|
|
|
specifies the operation to be performed.
|
|
|
|
RTP_LOOKUP to lookup the current priority,
|
1995-08-05 07:31:19 +00:00
|
|
|
and RTP_SET to set the priority.
|
1994-09-01 09:52:37 +00:00
|
|
|
.Fa pid
|
1995-08-05 07:31:19 +00:00
|
|
|
specifies the process to be used, 0 for the current process.
|
2000-06-23 20:35:45 +00:00
|
|
|
.Pp
|
1995-08-05 07:31:19 +00:00
|
|
|
.Fa *rtp
|
|
|
|
is a pointer to a struct rtprio which is used to specify the priority and priority type.
|
|
|
|
This structure has the following form:
|
|
|
|
.Bd -literal
|
|
|
|
struct rtprio {
|
|
|
|
u_short type;
|
|
|
|
u_short prio;
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The value of the
|
|
|
|
.Nm 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
|
|
|
|
.Nm prio
|
|
|
|
field ranges between 0 and
|
|
|
|
.Dv RTP_PRIO_MAX (usually 31) .
|
1994-09-01 09:52:37 +00:00
|
|
|
0 is the highest possible priority.
|
2000-06-23 20:35:45 +00:00
|
|
|
.Pp
|
1995-08-05 07:31:19 +00:00
|
|
|
Realtime and idle priority is inherited through fork() and exec().
|
2000-06-23 20:35:45 +00:00
|
|
|
.Pp
|
1994-09-01 09:52:37 +00:00
|
|
|
A realtime process can only be preempted by a process of equal or
|
1995-08-05 07:31:19 +00:00
|
|
|
higher priority, or by an interrupt; idle priority processes will run only
|
2000-03-02 09:14:21 +00:00
|
|
|
when no other real/normal priority process is runnable.
|
|
|
|
Higher real/idle priority processes
|
|
|
|
preempt lower real/idle priority processes.
|
|
|
|
Processes of equal real/idle priority are run round-robin.
|
1994-09-01 09:52:37 +00:00
|
|
|
.Sh RETURN VALUES
|
1995-08-05 07:31:19 +00:00
|
|
|
.Fn rtprio
|
2000-03-02 09:14:21 +00:00
|
|
|
will return 0 for success and -1 for all errors.
|
|
|
|
The global variable
|
1995-08-05 07:31:19 +00:00
|
|
|
.Va errno
|
|
|
|
will be set to indicate the error.
|
1994-09-01 09:52:37 +00:00
|
|
|
.Sh ERRORS
|
1995-08-05 07:31:19 +00:00
|
|
|
.Fn rtprio
|
1994-09-01 09:52:37 +00:00
|
|
|
will fail if
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The specified
|
|
|
|
.Fa prio
|
|
|
|
was out of range.
|
|
|
|
.It Bq Er EPERM
|
2000-03-02 09:14:21 +00:00
|
|
|
The calling process is not allowed to set the realtime priority.
|
|
|
|
Only
|
1995-08-05 07:31:19 +00:00
|
|
|
root is allowed to change the realtime priority of any process, and non-root
|
|
|
|
may only change the idle priority of the current process.
|
1994-09-01 09:52:37 +00:00
|
|
|
.It Bq Er ESRCH
|
|
|
|
The specified process was not found.
|
1998-03-19 07:34:22 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
The original author was
|
|
|
|
.An Henrik Vestergaard Draboel Aq hvd@terry.ping.dk .
|
|
|
|
This implementation in
|
1999-09-05 07:02:22 +00:00
|
|
|
.Fx
|
1998-03-19 07:34:22 +00:00
|
|
|
was substantially rewritten by
|
|
|
|
.An David Greenman .
|
1994-09-01 09:52:37 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr nice 1 ,
|
|
|
|
.Xr ps 1 ,
|
1997-01-20 23:23:22 +00:00
|
|
|
.Xr rtprio 1 ,
|
1996-02-11 22:38:05 +00:00
|
|
|
.Xr setpriority 2 ,
|
|
|
|
.Xr nice 3 ,
|
1994-09-01 09:52:37 +00:00
|
|
|
.Xr renice 8
|