summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index b62985dd7b..91faa494ca 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -35,6 +35,8 @@ import errno
35import signal 35import signal
36from commands import getstatusoutput 36from commands import getstatusoutput
37from contextlib import contextmanager 37from contextlib import contextmanager
38from ctypes import cdll
39
38 40
39logger = logging.getLogger("BitBake.Util") 41logger = logging.getLogger("BitBake.Util")
40 42
@@ -1291,3 +1293,20 @@ def get_file_layer(filename, d):
1291 result = path_to_layer(filename) 1293 result = path_to_layer(filename)
1292 1294
1293 return result 1295 return result
1296
1297
1298# Constant taken from http://linux.die.net/include/linux/prctl.h
1299PR_SET_PDEATHSIG = 1
1300
1301class PrCtlError(Exception):
1302 pass
1303
1304def signal_on_parent_exit(signame):
1305 """
1306 Trigger signame to be sent when the parent process dies
1307 """
1308 signum = getattr(signal, signame)
1309 # http://linux.die.net/man/2/prctl
1310 result = cdll['libc.so.6'].prctl(PR_SET_PDEATHSIG, signum)
1311 if result != 0:
1312 raise PrCtlError('prctl failed with error code %s' % result)