[bitbake-devel] [PATCH] build/utils: Add BB_TASK_IONICE_LEVEL support
Christopher Larson
clarson at kergoth.com
Sat Oct 24 22:26:30 UTC 2015
On Sat, Oct 24, 2015 at 3:19 AM, Richard Purdie <
richard.purdie at linuxfoundation.org> wrote:
> diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
> index eb219c1..86a5328 100644
> --- a/bitbake/lib/bb/utils.py
> +++ b/bitbake/lib/bb/utils.py
> @@ -1310,3 +1310,27 @@ def signal_on_parent_exit(signame):
> result = cdll['libc.so.6'].prctl(PR_SET_PDEATHSIG, signum)
> if result != 0:
> raise PrCtlError('prctl failed with error code %s' % result)
> +
> +#
> +# Manually call the ioprio syscall. We could depend on other libs like
> psutil
> +# however this gets us enough of what we need to bitbake for now without
> the
> +# dependency
> +#
> +_unamearch = os.uname()[4]
> +IOPRIO_WHO_PROCESS = 1
> +IOPRIO_CLASS_SHIFT = 13
> +
> +def ioprio_set(who, cls, value):
> + NR_ioprio_set = None
> + if _unamearch == "x86_64":
> + NR_ioprio_set = 251
> + elif _unamearch[0] == "i" and _unamearch[2:3] == "86":
> + NR_ioprio_set = 289
> +
> + if NR_ioprio_set:
> + ioprio = value | (cls << IOPRIO_CLASS_SHIFT)
> + rc = cdll['libc.so.6'].syscall(NR_ioprio_set, IOPRIO_WHO_PROCESS,
> who, ioprio)
> + if rc != 0:
> + raise ValueError("Unable to set ioprio, syscall returned %s"
> % rc)
>
Question, is the only way the syscall ran return non-zero the case where
the ioprio vaue is wrong? If it can fail for any other reason (e.g.
interrupted syscall), this probably isn't always a ValueError.
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20151024/693a6446/attachment-0002.html>
More information about the bitbake-devel
mailing list