On Tue, Jul 10, 2007 at 10:37:31PM -0600, LaMont Jones wrote: > Given that the kernel defines __NR_ioprio_{set,get} for every > architecture, is there any reason that schedutils/ionice.c should have > its own copy of some (but not all) of those? I think that code wants to > be removed... Good point. Thanks. The code is probably from time when there wasn't SYS_ioprio_{set,get} provided by any glibc version. (The orignal version is probably from Documentation/block/ioprio.txt) Fixed. Karel commit 4dfadf9c3abcdd9171a7bd81aedd4ec67d38d7b8 Author: Karel Zak <kzak@xxxxxxxxxx> Date: Mon Jul 16 11:56:23 2007 +0200 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 <kzak@xxxxxxxxxx> diff --git a/schedutils/ionice.c b/schedutils/ionice.c index fe3b4a9..ac72121 100644 --- a/schedutils/ionice.c +++ b/schedutils/ionice.c @@ -15,39 +15,46 @@ #include <sys/syscall.h> #include <asm/unistd.h> -#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 { -- Karel Zak <kzak@xxxxxxxxxx> - To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html