[bitbake-devel] [PATCH][RFC] bitbake-worker: set the process name when starting a task
Richard Purdie
richard.purdie at linuxfoundation.org
Thu Jan 7 14:00:08 UTC 2016
On Wed, 2016-01-06 at 14:42 -0700, Christopher Larson wrote:
> On Wed, Jan 6, 2016 at 9:25 AM, Ross Burton <ross.burton at intel.com>
> wrote:
> > If the setproctitle module is present then use it to change the
> > process name
> > when the worker starts a task. This results in each worker showing
> > what task it
> > is executing in a process listing.
> >
> > Signed-off-by: Ross Burton <ross.burton at intel.com>
> >
> Very nice. Do you know if it's overwriting just the process name or
> the entire commandline? I'm wondering if pkill bitbake-worker would
> do what you want, or if you'd still need to use pkill -f, for
> example. I'd like to see the toplevel bitbake processes named nicely
> without the python path and whatnot too eventually. We could also
> name the parallel parsing processes (though admittedly they're not
> long lived). Perhaps this should go into a helper function in
> bb.utils or bb.process?
There is a slightly more ugly version of this we could use:
def set_process_title(name):
from ctypes import cdll, byref, create_string_buffer
libc = cdll.LoadLibrary('libc.so.6')
buff = create_string_buffer(len(name)+1)
buff.value = name
libc.prctl(15, byref(buff), 0, 0, 0)
which would then mean we don't have a dependency on the external
module. Obviously using ctypes is a bit nasty though.
I would like to see this markup the worker/cooker/UI threads and so
on...
Cheers,
Richard
More information about the bitbake-devel
mailing list