THR_SET_NAME(2)
π THR_SET_NAME(2) π
okay bestie, so this is a system call β from the System Calls Manual β and it's literally called thr_set_name. Yes, that's the whole vibe: it sets the user-visible thread name. π
β¨ NAME β¨
thr_set_name β set user-visible thread name π·οΈ
π LIBRARY π
Standard C Library (libc, -lc) π«Ά
πΈ SYNOPSIS πΈ
#include <sys/thr.h>
int
thr_set_name(long id, const char *name);
π DESCRIPTION π
so basically, the thr_set_name() system call sets the user-visible name for the thread with the identifier id β in the current process, no cap β to the NUL-terminated string name. β¨
and listen. the name gets silently truncated to fit into a buffer of MAXCOMLEN + 1 bytes. no error, no warning, no drama β it just gets cut off. π so if you name your thread something iconic and long, only the beginning survives. keep that in mind, bestie.
where does the name show up, you ask? literally everywhere, it's giving main character energy: π
- the output of
ps(1)andtop(1)commands - the kernel debuggers π
- the kernel tracing facility outputs
- userland debuggers and program core files β as notes
π₯ RETURN VALUES π₯
if it slays: thr_set_name() returns zero. π
if it does not slay: -1 is returned, and errno is set to indicate the error. π
π¨ ERRORS π¨
the thr_set_name() system call may return the following errors:
[EFAULT]β the memory pointed to by thenameargument is not valid. π[ESRCH]β the thread with the identifieriddoes not exist in the current process. π
π SEE ALSO π
ps(1), thr_exit(2), thr_kill(2), thr_kill2(2), thr_new(2), thr_self(2), _umtx_op(2), pthread_set_name_np(3), ddb(4), ktr(9) π¦
β STANDARDS β
the thr_set_name() system call is non-standard β periodt. it's used by the 1:1 Threading Library (libthr, -lthr). π
and that's the whole page, bestie!! π this one shipped from Debian, dated December 2, 2016 β so like, a vintage icon at this point. go name ur threads something cute πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2016 The FreeBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms