Is there any way of setting the name of a thread in Linux?
My main purpose is it would be helpful while debugging, and also nice if that name was exposed through e.g.
prctl(2) function with the option
PR_SET_NAME (see the docs).
Note that the docs are a bit confusing. They say
Set the process name for the calling process
but since threads are light weight processes (LWP) on Linux, one thread is one process in this case.
You can see the thread name with
ps -o cmd or in
/proc/$PID/stat between the
4223 (kjournald) S 1 1 1 0...