xref: /illumos-gate/usr/src/man/man3c/pthread_attr_getname_np.3c (revision 5bb0bdfe588c5df0f63ff8ac292cd608a5f4492a)
1.\"
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
5.\" 1.0 of the CDDL.
6.\"
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.
10.\"
11.\"
12.\" Copyright 2018 Joyent, Inc.
13.\"
14.Dd "August 22, 2018"
15.Dt PTHREAD_ATTR_GETNAME_NP 3C
16.Os
17.Sh NAME
18.Nm pthread_attr_getname_np ,
19.Nm pthread_attr_setname_np
20.Nd get or set thread name attribute
21.Sh SYNOPSIS
22.In pthread.h
23.
24.Ft int
25.Fo pthread_attr_getname_np
26.Fa "pthread_attr_t *restrict attr"
27.Fa "char *name"
28.Fa "size_t len"
29.Fc
30.
31.Ft int
32.Fo pthread_attr_setname_np
33.Fa "pthread_attr_t *restrict attr"
34.Fa "const char *name"
35.Fc
36.
37.Sh DESCRIPTION
38The
39.Fn pthread_attr_setname_np
40and
41.Fn pthread_attr_getname_np
42functions, respectively, set and get the thread name attribute in
43.Fa attr
44to
45.Fa name .
46For
47.Fn pthread_attr_getname_np ,
48.Fa len
49is the size of
50.Fa name .
51Any threads created with
52.Xr pthread_create 3c
53using
54.Fa attr
55will have their name set to
56.Fa name
57upon creation.
58.Pp
59Thread names are limited to
60.Dv PTHREAD_MAX_NAMELEN_NP
61including the terminating NUL.
62They may only contain printable ASCII characters.
63.Sh RETURN VALUES
64Upon successful completion, the
65.Fn pthread_attr_getname_np
66and
67.Fn pthread_attr_setname_np
68functions return
69.Sy 0 .
70Otherwise, an error number is returned to indicate the error.
71.Sh ERRORS
72The
73.Fn pthread_attr_getname_np
74function may fail with:
75.Bl -tag -width Er
76.It Er EINVAL
77The
78.Fa name
79argument is
80.Sy NULL .
81.It Er ERANGE
82The size of
83.Fa name
84as indicated by
85.Fa len
86is too small to contain the thread name.
87The buffer may be over-written with partial contents of the thread name.
88.El
89.Pp
90The
91.Fn pthread_attr_setname_np
92function may fail with:
93.Bl -tag -width Er
94.It Er ERANGE
95The length of name given in
96.Fa name
97exceeds the maximum size allowed.
98.El
99.Sh INTERFACE STABILITY
100.Sy Uncommitted
101.Sh MT-LEVEL
102.Sy MT-Safe
103.Sh SEE ALSO
104.Xr pthread_create 3c ,
105.Xr pthread_getname_np 3c
106