[Toybox] [PATCH] Fix ionice's return value for getting process IO priority

Rob Landley rob at landley.net
Sat Jun 1 04:23:09 PDT 2024



On 5/30/24 07:23, enh via Toybox wrote:
> [note: this isn't my patch; it was
> https://android-review.googlesource.com/c/platform/external/toybox/+/3106282,
> and i'm just forwarding it. the attachment is the original patch with
> the original author's details, and i've cc:ed them. lgtm to me,
> though, and matches the next function in the same file.]
> 
> In the user version, if you use ionice to get the process IO
> priority without permission, -1 will be returned, but Idle: prio 7
> will be printed at this time. This is an incorrect priority and
> should return permission denied.

Applied, and then I did 70a5259261ea cleanup on top of it (move the error
handling into the syscall wrappers, renamed with x prefix, and clean up a couple
printfs that didn't need to assign back to the global variables while I was
there), which I don't THINK broke anything but I don't have a particularly
thorough way to test it here?

I set the ioprio of a backgrounded "sleep" command, and it read back what I'd
sent, but debian's and toybox's commands varied a bit:

  $ sleep 1000 &
  [1] 18361
  $ ./ionice -p 18361
  unknown: prio 0
  $ ionice -p 18361
  none: prio 0
  $ ./ionice -p 18361 -c 3 -n 2
  $ ./ionice -p 18361
  Idle: prio 2
  $ ionice -p 18361
  idle

Looks ok to me?

Rob


More information about the Toybox mailing list