<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 24, 2015 at 3:19 AM, Richard Purdie <span dir="ltr"><<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":1fv" class="a3s" style="overflow:hidden">diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py<br>
index eb219c1..86a5328 100644<br>
--- a/bitbake/lib/bb/utils.py<br>
+++ b/bitbake/lib/bb/utils.py<br>
@@ -1310,3 +1310,27 @@ def signal_on_parent_exit(signame):<br>
result = cdll['libc.so.6'].prctl(PR_SET_PDEATHSIG, signum)<br>
if result != 0:<br>
raise PrCtlError('prctl failed with error code %s' % result)<br>
+<br>
+#<br>
+# Manually call the ioprio syscall. We could depend on other libs like psutil<br>
+# however this gets us enough of what we need to bitbake for now without the<br>
+# dependency<br>
+#<br>
+_unamearch = os.uname()[4]<br>
+IOPRIO_WHO_PROCESS = 1<br>
+IOPRIO_CLASS_SHIFT = 13<br>
+<br>
+def ioprio_set(who, cls, value):<br>
+ NR_ioprio_set = None<br>
+ if _unamearch == "x86_64":<br>
+ NR_ioprio_set = 251<br>
+ elif _unamearch[0] == "i" and _unamearch[2:3] == "86":<br>
+ NR_ioprio_set = 289<br>
+<br>
+ if NR_ioprio_set:<br>
+ ioprio = value | (cls << IOPRIO_CLASS_SHIFT)<br>
+ rc = cdll['libc.so.6'].syscall(NR_ioprio_set, IOPRIO_WHO_PROCESS, who, ioprio)<br>
+ if rc != 0:<br>
+ raise ValueError("Unable to set ioprio, syscall returned %s" % rc)</div></blockquote></div><br>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.<br>-- <br><div class="gmail_signature">Christopher Larson<br>clarson at kergoth dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Maintainer - Tslib<br>Senior Software Engineer, Mentor Graphics</div>
</div></div>