1ab618543SJohn Levon.\" 2ab618543SJohn Levon.\" This file and its contents are supplied under the terms of the 3ab618543SJohn Levon.\" Common Development and Distribution License ("CDDL"), version 1.0. 4ab618543SJohn Levon.\" You may only use this file in accordance with the terms of version 5ab618543SJohn Levon.\" 1.0 of the CDDL. 6ab618543SJohn Levon.\" 7ab618543SJohn Levon.\" A full copy of the text of the CDDL should have accompanied this 8ab618543SJohn Levon.\" source. A copy of the CDDL is also available via the Internet at 9ab618543SJohn Levon.\" http://www.illumos.org/license/CDDL. 10ab618543SJohn Levon.\" 11ab618543SJohn Levon.\" 12ab618543SJohn Levon.\" Copyright 2018 Joyent, Inc. 13ab618543SJohn Levon.\" 14ab618543SJohn Levon.Dd August 31, 2018 15ab618543SJohn Levon.Dt PLWP_GETNAME 3PROC 16ab618543SJohn Levon.Os 17ab618543SJohn Levon.Sh NAME 18ab618543SJohn Levon.Nm Plwp_getname 19ab618543SJohn Levon.Nd get thread name 20ab618543SJohn Levon.Sh LIBRARY 21ab618543SJohn Levon.Lb libproc 22ab618543SJohn Levon.Sh SYNOPSIS 23ab618543SJohn Levon.In libproc.h 24ab618543SJohn Levon.Ft int 25ab618543SJohn Levon.Fo Plwp_getname 26ab618543SJohn Levon.Fa "struct ps_prochandle *P" 27ab618543SJohn Levon.Fa "lwpid_t lwpid" 28ab618543SJohn Levon.Fa "char *buf" 29ab618543SJohn Levon.Fa "size_t bufsize" 30ab618543SJohn Levon.Fc 31ab618543SJohn Levon.Sh DESCRIPTION 32ab618543SJohn LevonThe 33ab618543SJohn Levon.Fn Plwp_getname 34ab618543SJohn Levonfunction returns the thread name in the supplied buffer, from the 35ab618543SJohn Levonthread 36ab618543SJohn Levon.Fa lwpid 37ab618543SJohn Levonin the process handle 38ab618543SJohn Levon.Fa P . 39ab618543SJohn Levon.Pp 40ab618543SJohn LevonIf no thread name is set, the buffer is set to the empty string. 41ab618543SJohn LevonThe buffer should be at least 42ab618543SJohn Levon.Dv THREAD_NAME_MAX 43ab618543SJohn Levonin size. 44ab618543SJohn Levon.Pp 45ab618543SJohn LevonThe 46ab618543SJohn Levon.Fn Plwp_getname 47ab618543SJohn Levonfunction only works on process handles that refer to active processes 48ab618543SJohn Levonand core files, it does not work on process handles that refer to 49ab618543SJohn Levonindividual files. 50ab618543SJohn Levon.Sh RETURN VALUES 51ab618543SJohn LevonUpon successful completion, the 52ab618543SJohn Levon.Fn Plwp_getname 53ab618543SJohn Levonfunction returns 0. 54ab618543SJohn LevonOtherwise, 55ab618543SJohn Levon.Sy -1 56ab618543SJohn Levonis returned, 57ab618543SJohn Levon.Sy errno 58ab618543SJohn Levonis set to indicate the error. 59ab618543SJohn LevonThe buffer may be modified even if an error is returned. 60ab618543SJohn Levon.Sh ERRORS 61ab618543SJohn LevonFor a full list of possible errors also see the 62ab618543SJohn Levon.Sy DIAGNOSTICS 63ab618543SJohn Levonsection in 64*bbf21555SRichard Lowe.Xr proc 5 . 65ab618543SJohn Levon.Pp 66ab618543SJohn LevonThe 67ab618543SJohn Levon.Fn Plwp_getname 68ab618543SJohn Levonfunction will fail if: 69ab618543SJohn Levon.Bl -tag -width Er 70ab618543SJohn Levon.It Er ENODATA 71ab618543SJohn Levon.Fa P 72ab618543SJohn Levonrefers to a file handle obtained through 73ab618543SJohn Levon.Xr Pgrab_file 3PROC . 74ab618543SJohn Levon.It Er EINVAL 75ab618543SJohn LevonThe process handle 76ab618543SJohn Levon.Fa P 77ab618543SJohn Levonrefers to a core file and the specified thread does not exist. 78ab618543SJohn Levon.It Er ENOENT 79ab618543SJohn LevonThe process handle 80ab618543SJohn Levon.Fa P 81ab618543SJohn Levonrefers to an active process and the specified thread does not exist. 82ab618543SJohn Levon.Fa P 83ab618543SJohn Levon.It Er ENAMETOOLONG 84ab618543SJohn LevonThe buffer is not sufficient to hold the thread name. 85ab618543SJohn Levon.El 86ab618543SJohn Levon.Sh INTERFACE STABILITY 87ab618543SJohn Levon.Sy Uncommitted 88ab618543SJohn Levon.Sh MT-LEVEL 89ab618543SJohn LevonSee 90ab618543SJohn Levon.Sy LOCKING 91ab618543SJohn Levonin 92ab618543SJohn Levon.Xr libproc 3LIB . 93ab618543SJohn Levon.Sh SEE ALSO 94ab618543SJohn Levon.Xr libproc 3LIB , 95*bbf21555SRichard Lowe.Xr proc 5 96