1IOPRIO_SET(2) Linux Programmer's Manual IOPRIO_SET(2)
2
3
4
6 ioprio_get, ioprio_set - get/set I/O scheduling class and priority
7
9 #include <linux/ioprio.h> /* Definition of IOPRIO_* constants */
10 #include <sys/syscall.h> /* Definition of SYS_* constants */
11 #include <unistd.h>
12
13 int syscall(SYS_ioprio_get, int which, int who);
14 int syscall(SYS_ioprio_set, int which, int who, int ioprio);
15
16 Note: glibc provides no wrappers for these system calls, necessitating
17 the use of syscall(2).
18
20 The ioprio_get() and ioprio_set() system calls get and set the I/O
21 scheduling class and priority of one or more threads.
22
23 The which and who arguments identify the thread(s) on which the system
24 calls operate. The which argument determines how who is interpreted,
25 and has one of the following values:
26
27 IOPRIO_WHO_PROCESS
28 who is a process ID or thread ID identifying a single process or
29 thread. If who is 0, then operate on the calling thread.
30
31 IOPRIO_WHO_PGRP
32 who is a process group ID identifying all the members of a
33 process group. If who is 0, then operate on the process group
34 of which the caller is a member.
35
36 IOPRIO_WHO_USER
37 who is a user ID identifying all of the processes that have a
38 matching real UID.
39
40 If which is specified as IOPRIO_WHO_PGRP or IOPRIO_WHO_USER when call‐
41 ing ioprio_get(), and more than one process matches who, then the re‐
42 turned priority will be the highest one found among all of the matching
43 processes. One priority is said to be higher than another one if it
44 belongs to a higher priority class (IOPRIO_CLASS_RT is the highest pri‐
45 ority class; IOPRIO_CLASS_IDLE is the lowest) or if it belongs to the
46 same priority class as the other process but has a higher priority
47 level (a lower priority number means a higher priority level).
48
49 The ioprio argument given to ioprio_set() is a bit mask that specifies
50 both the scheduling class and the priority to be assigned to the target
51 process(es). The following macros are used for assembling and dissect‐
52 ing ioprio values:
53
54 IOPRIO_PRIO_VALUE(class, data)
55 Given a scheduling class and priority (data), this macro com‐
56 bines the two values to produce an ioprio value, which is re‐
57 turned as the result of the macro.
58
59 IOPRIO_PRIO_CLASS(mask)
60 Given mask (an ioprio value), this macro returns its I/O class
61 component, that is, one of the values IOPRIO_CLASS_RT, IO‐
62 PRIO_CLASS_BE, or IOPRIO_CLASS_IDLE.
63
64 IOPRIO_PRIO_DATA(mask)
65 Given mask (an ioprio value), this macro returns its priority
66 (data) component.
67
68 See the NOTES section for more information on scheduling classes and
69 priorities, as well as the meaning of specifying ioprio as 0.
70
71 I/O priorities are supported for reads and for synchronous (O_DIRECT,
72 O_SYNC) writes. I/O priorities are not supported for asynchronous
73 writes because