<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">&lt;<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>&gt;</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[&#39;libc.so.6&#39;].prctl(PR_SET_PDEATHSIG, signum)<br>
     if result != 0:<br>
         raise PrCtlError(&#39;prctl failed with error code %s&#39; % 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 == &quot;x86_64&quot;:<br>
+      NR_ioprio_set = 251<br>
+    elif _unamearch[0] == &quot;i&quot; and _unamearch[2:3] == &quot;86&quot;:<br>
+      NR_ioprio_set = 289<br>
+<br>
+    if NR_ioprio_set:<br>
+        ioprio = value | (cls &lt;&lt; IOPRIO_CLASS_SHIFT)<br>
+        rc = cdll[&#39;libc.so.6&#39;].syscall(NR_ioprio_set, IOPRIO_WHO_PROCESS, who, ioprio)<br>
+        if rc != 0:<br>
+            raise ValueError(&quot;Unable to set ioprio, syscall returned %s&quot; % 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&#39;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>