xref: /illumos-gate/usr/src/man/man3proc/Plwp_getname.3proc (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
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 31, 2018
15.Dt PLWP_GETNAME 3PROC
16.Os
17.Sh NAME
18.Nm Plwp_getname
19.Nd get thread name
20.Sh LIBRARY
21.Lb libproc
22.Sh SYNOPSIS
23.In libproc.h
24.Ft int
25.Fo Plwp_getname
26.Fa "struct ps_prochandle *P"
27.Fa "lwpid_t lwpid"
28.Fa "char *buf"
29.Fa "size_t bufsize"
30.Fc
31.Sh DESCRIPTION
32The
33.Fn Plwp_getname
34function returns the thread name in the supplied buffer, from the
35thread
36.Fa lwpid
37in the process handle
38.Fa P .
39.Pp
40If no thread name is set, the buffer is set to the empty string.
41The buffer should be at least
42.Dv THREAD_NAME_MAX
43in size.
44.Pp
45The
46.Fn Plwp_getname
47function only works on process handles that refer to active processes
48and core files, it does not work on process handles that refer to
49individual files.
50.Sh RETURN VALUES
51Upon successful completion, the
52.Fn Plwp_getname
53function returns 0.
54Otherwise,
55.Sy -1
56is returned,
57.Sy errno
58is set to indicate the error.
59The buffer may be modified even if an error is returned.
60.Sh ERRORS
61For a full list of possible errors also see the
62.Sy DIAGNOSTICS
63section in
64.Xr proc 4 .
65.Pp
66The
67.Fn Plwp_getname
68function will fail if:
69.Bl -tag -width Er
70.It Er ENODATA
71.Fa P
72refers to a file handle obtained through
73.Xr Pgrab_file 3PROC .
74.It Er EINVAL
75The process handle
76.Fa P
77refers to a core file and the specified thread does not exist.
78.It Er ENOENT
79The process handle
80.Fa P
81refers to an active process and the specified thread does not exist.
82.Fa P
83.It Er ENAMETOOLONG
84The buffer is not sufficient to hold the thread name.
85.El
86.Sh INTERFACE STABILITY
87.Sy Uncommitted
88.Sh MT-LEVEL
89See
90.Sy LOCKING
91in
92.Xr libproc 3LIB .
93.Sh SEE ALSO
94.Xr libproc 3LIB ,
95.Xr proc 4
96