socket/socketpair: Add SOCK_{NONBLOCK,CLOEXEC} support.
[dragonfly.git] / lib / libc / sys / ioprio_get.2
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
47 The
48 .Fn ioprio_get
49 and
50 .Fn ioprio_set
51 functions get and set the I/O scheduler priority of a process, process group
52 or all processes of a user.
53 .Pp
54 The
55 .Fa which
56 argument specifies what type of resource's priority is to be modified.
57 It 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
61 A single process
62 .It Dv PRIO_PGRP
63 A process group
64 .It Dv PRIO_USER
65 All processes of a user
66 .El
67 .Pp
68 The
69 .Fa who
70 argument specifies, depending on the
71 .Fa which
72 argument, either the process ID (if
73 .Fa which
74 is
75 .Dv PRIO_PROCESS ) ,
76 the process group ID (if
77 .Fa which
78 is
79 .Dv PRIO_PGRP ) ,
80 or the user ID (if
81 .Fa which
82 is
83 .Dv PRIO_USER ) .
84 A value of 0 specifies either the current process, the current process group,
85 or the current user.
86 .Pp
87 For the
88 .Fn ioprio_set
89 function, the
90 .Fa prio
91 argument specifies the priority to be set.
92 It 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
96 The
97 .Fn ioprio_get
98 function will fail if:
99 .Bl -tag -width ".Bq Er EINVAL"
100 .It Bq Er EINVAL
101 An invalid value was specified for the
102 .Fa which
103 argument
104 .It Bq Er ESRCH
105 No corresponding process, process group or user could be found for the ID
106 specified in
107 .Fa who
108 .El
109 .Pp
110 The
111 .Fn ioprio_set
112 function will fail if:
113 .Bl -tag -width ".Bq Er EACCES"
114 .It Bq Er EACCES
115 The caller isn't allowed to access the I/O priority
116 .It Bq Er EINVAL
117 An invalid value was specified for the
118 .Fa which
119 argument
120 .It Bq Er EPERM
121 The caller doesn't own the specified process or processes
122 .It Bq Er ESRCH
123 No corresponding process, process group or user could be found for the ID
124 specified in
125 .Fa who
126 .El
127 .Sh SEE ALSO
128 .Xr ioprio 1
129 .Sh HISTORY
130 The
131 .Fn ioprio_get
132 and
133 .Fn ioprio_set
134 function calls first appeared in
135 .Dx 2.7 .
136 .Sh AUTHORS
137 .An -nosplit
138 .An Alex Hornung