xref: /dragonfly/lib/libc/sys/ioprio_get.2 (revision 6e5c5008)
1.\"
2.\" Copyright (c) 2010 The DragonFly Project.  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.\"
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
12.\"    the documentation and/or other materials provided with the
13.\"    distribution.
14.\" 3. Neither the name of The DragonFly Project nor the names of its
15.\"    contributors may be used to endorse or promote products derived
16.\"    from this software without specific, prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
22.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
24.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
28.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.Dd May 12, 2010
32.Dt IOPRIO_GET 2
33.Os
34.Sh NAME
35.Nm ioprio_get ,
36.Nm ioprio_set
37.Nd get/set the I/O priority
38.Sh LIBRARY
39.Lb libc
40.Sh SYNOPSIS
41.In sys/resource.h
42.Ft int
43.Fn ioprio_get "int which" "int who"
44.Ft int
45.Fn ioprio_set "int which" "int who" "int prio"
46.Sh DESCRIPTION
47The
48.Fn ioprio_get
49and
50.Fn ioprio_set
51functions get and set the I/O scheduler priority of a process, process group
52or all processes of a user.
53.Pp
54The
55.Fa which
56argument specifies what type of resource's priority is to be modified.
57It can have the following values (as defined in
58.In sys/resource.h ) :
59.Bl -tag -width ".Dv PRIO_PROCESS"
60.It Dv PRIO_PROCESS
61A single process
62.It Dv PRIO_PGRP
63A process group
64.It Dv PRIO_USER
65All processes of a user
66.El
67.Pp
68The
69.Fa who
70argument specifies, depending on the
71.Fa which
72argument, either the process ID (if
73.Fa which
74is
75.Dv PRIO_PROCESS ) ,
76the process group ID (if
77.Fa which
78is
79.Dv PRIO_PGRP ) ,
80or the user ID (if
81.Fa which
82is
83.Dv PRIO_USER ) .
84A value of 0 specifies either the current process, the current process group,
85or the current user.
86.Pp
87For the
88.Fn ioprio_set
89function, the
90.Fa prio
91argument specifies the priority to be set.
92It can range from 1 to 10, with higher numbers indicating a higher priority.
93.Sh RETURN VALUES
94.Rv -std ioprio_get ioprio_set
95.Sh ERRORS
96The
97.Fn ioprio_get
98function will fail if:
99.Bl -tag -width ".Bq Er EINVAL"
100.It Bq Er EINVAL
101An invalid value was specified for the
102.Fa which
103argument
104.It Bq Er ESRCH
105No corresponding process, process group or user could be found for the ID
106specified in
107.Fa who
108.El
109.Pp
110The
111.Fn ioprio_set
112function will fail if:
113.Bl -tag -width ".Bq Er EACCES"
114.It Bq Er EACCES
115The caller isn't allowed to access the I/O priority
116.It Bq Er EINVAL
117An invalid value was specified for the
118.Fa which
119argument
120.It Bq Er EPERM
121The caller doesn't own the specified process or processes
122.It Bq Er ESRCH
123No corresponding process, process group or user could be found for the ID
124specified in
125.Fa who
126.El
127.Sh SEE ALSO
128.Xr ioprio 1
129.Sh HISTORY
130The
131.Fn ioprio_get
132and
133.Fn ioprio_set
134function calls first appeared in
135.Dx 2.7 .
136.Sh AUTHORS
137.An -nosplit
138.An Alex Hornung
139