From: Karel Zak Date: Mon, 16 Jul 2007 09:56:23 +0000 (+0200) Subject: ionice: prefer SYS_ioprio_{set,get} from glibc to hardcoded version X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dfadf9c3abcdd9171a7bd81aedd4ec67d38d7b8;p=util-linux ionice: prefer SYS_ioprio_{set,get} from glibc to hardcoded version It's better to use glibc SYS_ioprio_{set,get} definitions rather than an incomplete (not all archs) and hardcoded version from ionice.c. Signed-off-by: Karel Zak --- diff --git a/schedutils/ionice.c b/schedutils/ionice.c index fe3b4a9a..ac721215 100644 --- a/schedutils/ionice.c +++ b/schedutils/ionice.c @@ -15,39 +15,46 @@ #include #include -#if defined(__i386__) -#define __NR_ioprio_set 289 -#define __NR_ioprio_get 290 -#elif defined(__powerpc__) || defined(__powerpc64__) -#define __NR_ioprio_set 273 -#define __NR_ioprio_get 274 -#elif defined(__x86_64__) -#define __NR_ioprio_set 251 -#define __NR_ioprio_get 252 -#elif defined(__ia64__) -#define __NR_ioprio_set 1274 -#define __NR_ioprio_get 1275 -#elif defined(__alpha__) -#define __NR_ioprio_set 442 -#define __NR_ioprio_get 443 -#elif defined(__s390x__) || defined(__s390__) -#define __NR_ioprio_set 282 -#define __NR_ioprio_get 283 -#elif defined(__sparc__) -#define __NR_ioprio_set 196 -#define __NR_ioprio_get 218 -#else -#error "Unsupported arch" -#endif +#if !defined(SYS_ioprio_get) || !defined(SYS_ioprio_set) + +# if defined(__i386__) +# define __NR_ioprio_set 289 +# define __NR_ioprio_get 290 +# elif defined(__powerpc__) || defined(__powerpc64__) +# define __NR_ioprio_set 273 +# define __NR_ioprio_get 274 +# elif defined(__x86_64__) +# define __NR_ioprio_set 251 +# define __NR_ioprio_get 252 +# elif defined(__ia64__) +# define __NR_ioprio_set 1274 +# define __NR_ioprio_get 1275 +# elif defined(__alpha__) +# define __NR_ioprio_set 442 +# define __NR_ioprio_get 443 +# elif defined(__s390x__) || defined(__s390__) +# define __NR_ioprio_set 282 +# define __NR_ioprio_get 283 +# elif defined(__sparc__) || defined(__sparc64__) +# define __NR_ioprio_set 196 +# define __NR_ioprio_get 218 +# else +# error "Unsupported arch" +# endif + +# define SYS_ioprio_get __NR_ioprio_get +# define SYS_ioprio_set __NR_ioprio_set + +#endif /* !SYS_ioprio_get */ static inline int ioprio_set(int which, int who, int ioprio) { - return syscall(__NR_ioprio_set, which, who, ioprio); + return syscall(SYS_ioprio_set, which, who, ioprio); } static inline int ioprio_get(int which, int who) { - return syscall(__NR_ioprio_get, which, who); + return syscall(SYS_ioprio_get, which, who); } enum {