2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2018 Joyent, Inc.
15 .Dt PTHREAD_GETNAME_NP 3C
18 .Nm pthread_getname_np ,
19 .Nm pthread_setname_np
20 .Nd get or set the name of a thread
25 .Fo pthread_getname_np
32 .Fo pthread_setname_np
34 .Fa "const char *name"
39 .Fn pthread_getname_np
41 .Fn pthread_setname_np
42 functions, respectively, get and set the names of the thread whose id is given
47 .Fn pthread_getname_np ,
52 Thread names are limited to
53 .Dv PTHREAD_MAX_NAMELEN_NP
54 including the terminating NUL.
55 They may only contain printable ASCII characters.
57 To clear a thread name, call
58 .Fn pthread_setname_np
62 Unlike some other systems, threads do not inherit the process name by default.
64 Upon successful completion, the
65 .Fn pthread_getname_np
67 .Fn pthread_setname_np
70 Otherwise, an error number is returned to indicate the error.
71 If the thread identified by
73 does not have a name set,
74 .Fa pthread_getname_np
75 will be set to an empty string (length = 0).
77 On failure, the contents of the buffer are undefined.
85 .Fn pthread_getname_np
86 function will fail with:
98 was not large enough to contain the name of the thread.
106 .Fn pthread_setname_np
107 function will fail with:
112 exceeds the maximum allowed size.
118 .Sh INTERFACE STABILITY
123 .Xr pthread_attr_getname_np 3c ,
124 .Xr pthread_create 3c