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