From: Elliott Hughes Date: Wed, 8 Jul 2015 07:32:57 +0000 (-0500) Subject: Fix ionice. X-Git-Tag: upstream/0.6.0~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=29b0a2e823e2b451e793b9cd891107d4daec3864;p=platform%2Fupstream%2Ftoybox.git Fix ionice. ioprio_set takes a "prio" argument that combines class and level. Although bionic (via the uapi headers) includes the appropriate constants and even a convenience macro, glibc doesn't, so just hard-code the encoding. Also fix the sense of a conditional so we actually execute the provided command. --- diff --git a/toys/other/ionice.c b/toys/other/ionice.c index 82f8fde..e44270a 100644 --- a/toys/other/ionice.c +++ b/toys/other/ionice.c @@ -52,7 +52,9 @@ static int ioprio_get(void) static int ioprio_set(void) { - return syscall(__NR_ioprio_set, 1, (int)TT.pid, (int)TT.class, (int)TT.level); + int prio = ((int)TT.class << 13) | (int)TT.level; + + return syscall(__NR_ioprio_set, 1, (int)TT.pid, prio); } void ionice_main(void) @@ -65,7 +67,7 @@ void ionice_main(void) p&7); } else { if (-1 == ioprio_set() && !(toys.optflags&FLAG_t)) perror_exit("set"); - if (TT.pid) xexec(toys.optargs); + if (!TT.pid) xexec(toys.optargs); } }