blob: cae07660fcbd24d30e26c086411ab80d039a206c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
.\" $OpenBSD: pthread_set_name_np.3,v 1.10 2025/12/03 17:09:23 kurt Exp $
.\" David Leonard <d@openbsd.org>, 1999. Public domain.
.Dd $Mdocdate: December 3 2025 $
.Dt PTHREAD_SET_NAME_NP 3
.Os
.Sh NAME
.Nm pthread_set_name_np ,
.Nm pthread_get_name_np
.Nd set the name of a thread
.Sh SYNOPSIS
.Lb libpthread
.In pthread_np.h
.Ft void
.Fn pthread_set_name_np "pthread_t thread" "const char *name"
.Ft void
.Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len"
.Sh DESCRIPTION
The
.Fn pthread_set_name_np
function associates
.Fa name
with
.Fa thread .
This can be useful for debugging, as the name is displayed in
the thread status as displayed when the process receives the
.Dv SIGINFO
signal.
.Pp
The string pointed to by
.Fa name
is copied, and so need not be valid for the life of the thread.
A maximum of
.Dv _MAXCOMLEN
- 1 bytes of
.Fa name
will be copied.
.Pp
The
.Fn pthread_get_name_np
function retrieves
.Fa name
associated with
.Fa thread .
The
.Fa len
of buffer
.Fa name
should be at least
.Dv _MAXCOMLEN
bytes otherwise
.Fa name
will be truncated to fit in a buffer
.Fa len
bytes long.
.Sh SEE ALSO
.Xr pthreads 3
.Sh STANDARDS
These functions are non-portable and may not be supported with the above
semantics on other POSIX systems.
|