blob: fbac370410bffe3eedc79a04b8bfaf0bc4dc6ccc (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright 2018 Joyent, Inc.
.\"
.Dd "August 22, 2018"
.Dt PTHREAD_ATTR_GETNAME_NP 3C
.Os
.Sh NAME
.Nm pthread_attr_getname_np ,
.Nm pthread_attr_setname_np
.Nd get or set thread name attribute
.Sh SYNOPSIS
.In pthread.h
.
.Ft int
.Fo pthread_attr_getname_np
.Fa "pthread_attr_t *restrict attr"
.Fa "char *name"
.Fa "size_t len"
.Fc
.
.Ft int
.Fo pthread_attr_setname_np
.Fa "pthread_attr_t *restrict attr"
.Fa "const char *name"
.Fc
.
.Sh DESCRIPTION
The
.Fn pthread_attr_setname_np
and
.Fn pthread_attr_getname_np
functions, respectively, set and get the thread name attribute in
.Fa attr
to
.Fa name .
For
.Fn pthread_attr_getname_np ,
.Fa len
is the size of
.Fa name .
Any threads created with
.Xr pthread_create 3c
using
.Fa attr
will have their name set to
.Fa name
upon creation.
.Pp
Thread names are limited to
.Dv PTHREAD_MAX_NAMELEN_NP
including the terminating NUL.
They may only contain printable ASCII characters.
.Sh RETURN VALUES
Upon successful completion, the
.Fn pthread_attr_getname_np
and
.Fn pthread_attr_setname_np
functions return
.Sy 0 .
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_attr_getname_np
function may fail with:
.Bl -tag -width Er
.It Er EINVAL
The
.Fa name
argument is
.Sy NULL .
.It Er ERANGE
The size of
.Fa name
as indicated by
.Fa len
is too small to contain the thread name.
The buffer may be over-written with partial contents of the thread name.
.El
.Pp
The
.Fn pthread_attr_setname_np
function may fail with:
.Bl -tag -width Er
.It Er ERANGE
The length of name given in
.Fa name
exceeds the maximum size allowed.
.El
.Sh INTERFACE STABILITY
.Sy Uncommitted
.Sh MT-LEVEL
.Sy MT-Safe
.Sh SEE ALSO
.Xr pthread_create 3c ,
.Xr pthread_getname_np 3c
|