8158 Want named threads API
[unleashed.git] / usr / src / man / man3c / pthread_attr_getname_np.3c
blobfbac370410bffe3eedc79a04b8bfaf0bc4dc6ccc
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
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
31 .Ft int
32 .Fo pthread_attr_setname_np
33 .Fa "pthread_attr_t *restrict attr"
34 .Fa "const char *name"
35 .Fc
37 .Sh DESCRIPTION
38 The
39 .Fn pthread_attr_setname_np
40 and
41 .Fn pthread_attr_getname_np
42 functions, respectively, set and get the thread name attribute in
43 .Fa attr
45 .Fa name .
46 For
47 .Fn pthread_attr_getname_np ,
48 .Fa len
49 is the size of
50 .Fa name .
51 Any threads created with
52 .Xr pthread_create 3c
53 using
54 .Fa attr
55 will have their name set to
56 .Fa name
57 upon creation.
58 .Pp
59 Thread names are limited to
60 .Dv PTHREAD_MAX_NAMELEN_NP
61 including the terminating NUL.
62 They may only contain printable ASCII characters.
63 .Sh RETURN VALUES
64 Upon successful completion, the
65 .Fn pthread_attr_getname_np
66 and
67 .Fn pthread_attr_setname_np
68 functions return
69 .Sy 0 .
70 Otherwise, an error number is returned to indicate the error.
71 .Sh ERRORS
72 The
73 .Fn pthread_attr_getname_np
74 function may fail with:
75 .Bl -tag -width Er
76 .It Er EINVAL
77 The
78 .Fa name
79 argument is
80 .Sy NULL .
81 .It Er ERANGE
82 The size of
83 .Fa name
84 as indicated by
85 .Fa len
86 is too small to contain the thread name.
87 The buffer may be over-written with partial contents of the thread name.
88 .El
89 .Pp
90 The
91 .Fn pthread_attr_setname_np
92 function may fail with:
93 .Bl -tag -width Er
94 .It Er ERANGE
95 The length of name given in
96 .Fa name
97 exceeds 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