Revert "Custom setproctitle (#32667)"
This reverts commit 1f45e163559baa2a6127d5a5e8deb7067e32f813.
old-commit-hash: 5b51f03967
testing-closet^2
parent
83350bbd22
commit
e920e57530
7 changed files with 14 additions and 40 deletions
@ -1,8 +0,0 @@ |
|||||||
from openpilot.common.threadname import setthreadname, getthreadname, LINUX |
|
||||||
|
|
||||||
class TestThreadName: |
|
||||||
def test_set_get_threadname(self): |
|
||||||
if LINUX: |
|
||||||
name = 'TESTING' |
|
||||||
setthreadname(name) |
|
||||||
assert name == getthreadname() |
|
@ -1,19 +0,0 @@ |
|||||||
import ctypes |
|
||||||
import os |
|
||||||
|
|
||||||
LINUX = os.name == 'posix' and os.uname().sysname == 'Linux' |
|
||||||
|
|
||||||
if LINUX: |
|
||||||
libc = ctypes.CDLL('libc.so.6') |
|
||||||
|
|
||||||
def setthreadname(name: str) -> None: |
|
||||||
if LINUX: |
|
||||||
name = name[:15] + '\0' |
|
||||||
libc.prctl(15, str.encode(name), 0, 0, 0) |
|
||||||
|
|
||||||
def getthreadname() -> str: |
|
||||||
if LINUX: |
|
||||||
name = ctypes.create_string_buffer(16) |
|
||||||
libc.prctl(16, name) |
|
||||||
return name.value.decode('utf-8') |
|
||||||
return "" |
|
Loading…
Reference in new issue