This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Set thread name in linux kernel
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
Status: closed Resolution: duplicate
Dependencies: Superseder: Python should support exporting thread names to the OS
View: 15500
Assigned To: Nosy List: neologix, pitrou, r.david.murray, socketpair
Priority: normal Keywords:

Created on 2013-05-18 11:44 by socketpair, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg189507 - (view) Author: Марк Коренберг (socketpair) * Date: 2013-05-18 11:44
In linux (Since 2.6.9) we can use syscall

prctl(PR_SET_NAME, "Some thread name")

to set thread name to the kernel. This thread is seen  under this name in some process tool (like top, ps, pstree (have bug reported connected with this) and others).

It will be nice if this syscall will be called (from correspoding thread=TID) when changing (setting) thread name.

Note, that in current implementation name will be truncated to 15 bytes in kernel.

This work very well using ctypes or python-prctl module.

Also there is error in manpage about prctl saying that name is set to process (already sent to maintainer). Really, name is set to each thread.
msg189512 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-05-18 13:17
This is effectively a duplicate of issue 5672.  Are you interested in carrying through the process outlined there by Martin?  Otherwise we should close this issue as well until someone does propose to do so.
msg189513 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-05-18 13:57
I'd also point out that changing the kernel thread name *by default* would be pretty much a large regression.
msg189570 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2013-05-19 08:01
It's a dupe of #15500.
Date User Action Args
2022-04-11 14:57:45adminsetgithub: 62206
2013-05-19 08:01:04neologixsetstatus: open -> closed

superseder: Python should support exporting thread names to the OS

nosy: + neologix
messages: + msg189570
resolution: duplicate
stage: resolved
2013-05-18 13:57:34pitrousetnosy: + pitrou
messages: + msg189513
2013-05-18 13:17:05r.david.murraysetnosy: + r.david.murray

messages: + msg189512
versions: - Python 3.3, Python 3.5
2013-05-18 11:44:26socketpairsettitle: Set thread nema in linux kernel -> Set thread name in linux kernel
2013-05-18 11:44:07socketpaircreate