summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 9b550ef3f1..7f82687ae4 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -1311,3 +1311,27 @@ def signal_on_parent_exit(signame):
1311 result = cdll['libc.so.6'].prctl(PR_SET_PDEATHSIG, signum) 1311 result = cdll['libc.so.6'].prctl(PR_SET_PDEATHSIG, signum)
1312 if result != 0: 1312 if result != 0:
1313 raise PrCtlError('prctl failed with error code %s' % result) 1313 raise PrCtlError('prctl failed with error code %s' % result)
1314
1315#
1316# Manually call the ioprio syscall. We could depend on other libs like psutil
1317# however this gets us enough of what we need to bitbake for now without the
1318# dependency
1319#
1320_unamearch = os.uname()[4]
1321IOPRIO_WHO_PROCESS = 1
1322IOPRIO_CLASS_SHIFT = 13
1323
1324def ioprio_set(who, cls, value):
1325 NR_ioprio_set = None
1326 if _unamearch == "x86_64":
1327 NR_ioprio_set = 251
1328 elif _unamearch[0] == "i" and _unamearch[2:3] == "86":
1329 NR_ioprio_set = 289
1330
1331 if NR_ioprio_set:
1332 ioprio = value | (cls << IOPRIO_CLASS_SHIFT)
1333 rc = cdll['libc.so.6'].syscall(NR_ioprio_set, IOPRIO_WHO_PROCESS, who, ioprio)
1334 if rc != 0:
1335 raise ValueError("Unable to set ioprio, syscall returned %s" % rc)
1336 else:
1337 bb.warn("Unable to set IO Prio for arch %s" % _unamearch)