2 * ioprio-glue.c - I/O priority wrappers for the big dog
4 * Robert Love <rml@novell.com>
6 * Copyright (C) 2005 Novell, Inc.
10 #define __NR_ioprio_set 289
11 #define __NR_ioprio_get 290
12 #elif defined(__powerpc__) || defined(__powerpc64__)
13 #define __NR_ioprio_set 273
14 #define __NR_ioprio_get 274
15 #elif defined(__x86_64__)
16 #define __NR_ioprio_set 251
17 #define __NR_ioprio_get 252
18 #elif defined(__ia64__)
19 #define __NR_ioprio_set 1274
20 #define __NR_ioprio_get 1275
21 #elif defined(__alpha__)
22 #define __NR_ioprio_set 442
23 #define __NR_ioprio_get 443
24 #elif defined(__s390x__) || defined(__s390__)
25 #define __NR_ioprio_set 282
26 #define __NR_ioprio_get 283
27 #elif defined(__SH4__)
28 #define __NR_ioprio_set 288
29 #define __NR_ioprio_get 289
30 #elif defined(__SH5__)
31 #define __NR_ioprio_set 316
32 #define __NR_ioprio_get 317
33 #elif defined(__sparc__) || defined(__sparc64__)
34 #define __NR_ioprio_set 196
35 #define __NR_ioprio_get 218
36 #elif defined(__arm__)
37 #define __NR_ioprio_set 314
38 #define __NR_ioprio_get 315
40 #error "Unsupported architecture!"
43 static inline int ioprio_set (int which
, int who
, int ioprio
)
45 return syscall (__NR_ioprio_set
, which
, who
, ioprio
);
48 static inline int ioprio_get (int which
, int who
)
50 return syscall (__NR_ioprio_get
, which
, who
);
61 IOPRIO_WHO_PROCESS
= 1,
66 #define IOPRIO_CLASS_SHIFT 13
67 #define IOPRIO_PRIO_MASK 0xff
69 int set_io_priority_idle (void)
73 ioprio
= 7; /* priority is ignored with idle class */
74 ioclass
= IOPRIO_CLASS_IDLE
<< IOPRIO_CLASS_SHIFT
;
76 return ioprio_set (IOPRIO_WHO_PROCESS
, 0, ioprio
| ioclass
);