diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-29 11:07:02 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-29 17:06:16 +0000 |
commit | fd7f1a94d196b8a3c445e313d9e699b352b1da97 (patch) | |
tree | a5fc9a9d60b94ea84a7f9d4baff27927bcedb082 /lib/bb/utils.py | |
parent | 8a3f50936113e15d2f2822f6aee494204fa1c24f (diff) | |
download | bitbake-contrib-fd7f1a94d196b8a3c445e313d9e699b352b1da97.tar.gz |
utils: Add ability to change the process name
Being able to tell the bitbake processes apart is useful for debugging.
Add a helper function which allows this without making it a hard
dependency. Errors are ignored, this is just nice to have.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r-- | lib/bb/utils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 9a3efb25d..ae10213ed 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -1395,3 +1395,14 @@ def ioprio_set(who, cls, value): raise ValueError("Unable to set ioprio, syscall returned %s" % rc) else: bb.warn("Unable to set IO Prio for arch %s" % _unamearch) + +def set_process_name(name): + from ctypes import cdll, byref, create_string_buffer + # This is nice to have for debugging, not essential + try: + libc = cdll.LoadLibrary('libc.so.6') + buff = create_string_buffer(len(name)+1) + buff.value = name + libc.prctl(15, byref(buff), 0, 0, 0) + except: + pass |