<div dir="ltr">Fix ionice.<div><br></div><div>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.</div><div><br></div><div>Also fix the sense of a conditional so we actually execute the provided command.</div><div><br></div><div><div><div>diff --git a/toys/other/ionice.c b/toys/other/ionice.c</div><div>index 82f8fde..e44270a 100644</div><div>--- a/toys/other/ionice.c</div><div>+++ b/toys/other/ionice.c</div><div>@@ -52,7 +52,9 @@ static int ioprio_get(void)</div><div> </div><div> static int ioprio_set(void)</div><div> {</div><div>- return syscall(__NR_ioprio_set, 1, (int)TT.pid, (int)TT.class, (int)TT.level);</div><div>+ int prio = ((int)TT.class << 13) | (int)TT.level;</div><div>+</div><div>+ return syscall(__NR_ioprio_set, 1, (int)TT.pid, prio);</div><div> }</div><div> </div><div> void ionice_main(void)</div><div>@@ -65,7 +67,7 @@ void ionice_main(void)</div><div> p&7);</div><div> } else {</div><div> if (-1 == ioprio_set() && !(toys.optflags&FLAG_t)) perror_exit("set");</div><div>- if (TT.pid) xexec(toys.optargs);</div><div>+ if (!TT.pid) xexec(toys.optargs);</div><div> }</div><div> }</div><div> </div></div><div><br></div>
</div></div>