THR_SET_NAME(2)
πΈ NAME πΈ
okay bestie, this is THR_SET_NAME(2), aka the page for thr_set_name β the system call that sets the user-visible thread name. slay, letβs get into it π
π LIBRARY π
Standard C Library (libc, -lc) β yes, thatβs the one, periodt.
β¨ SYNOPSIS β¨
#include <sys/thr.h>
int
thr_set_name(long id, const char *name);
π DESCRIPTION π
okay so thr_set_name() is the system call that sets the user-visible name for the thread with the identifier id in the current process to the NUL-terminated string name. cute, right? π
the name will be silently truncated to fit into a buffer of MAXCOMLEN + 1 bytes β no warning, no drama, it just gets shortened. lowkey iconic.
and where can you see this thread name? bestie, it shows up in the output of the ps(1) and top(1) commands, in the kernel debuggers and kernel tracing facility outputs, and in userland debuggers and program core files, as notes. literally everywhere the cool kids hang out π¦
π RETURN VALUES π
if everythingβs chill, thr_set_name() returns 0; otherwise, -1 is returned, and errno is set to indicate the error. no cap.
π 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)_umtx_op(2)thr_exit(2)thr_kill(2)thr_kill2(2)thr_new(2)thr_self(2)pthread_set_name_np(3)ddb(4)ktr(9)
π STANDARDS π
thr_set_name() is non-standard and is used by the 1:1 Threading Library (libthr, -lthr). iykyk β¨
β HISTORY β
thr_set_name() first appeared in FreeBSD 5.2. iconic behavior, honestly.
okay bye bestie π«Ά β this page is from Debian, dated May 5, 2020, and itβs THR_SET_NAME(2) π
β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2016 The FreeBSD Foundation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms