PLWP_GETNAME(3PROC) Process Control Library Functions PLWP_GETNAME(3PROC)

Plwp_getname
get thread name

Process Control Library (libproc, -lproc)

#include <libproc.h>
int
Plwp_getname(struct ps_prochandle *P, lwpid_t lwpid, char *buf, size_t bufsize);

The Plwp_getname() function returns the thread name in the supplied buffer, from the thread lwpid in the process handle P.
If no thread name is set, the buffer is set to the empty string. The buffer should be at least THREAD_NAME_MAX in size.
The Plwp_getname() function only works on process handles that refer to active processes and core files, it does not work on process handles that refer to individual files.

Upon successful completion, the Plwp_getname() function returns 0. Otherwise, -1 is returned, errno is set to indicate the error. The buffer may be modified even if an error is returned.

For a full list of possible errors also see the DIAGNOSTICS section in proc(4).
The Plwp_getname() function will fail if:
 
 
P refers to a file handle obtained through Pgrab_file(3PROC).
 
 
The process handle P refers to a core file and the specified thread does not exist.
 
 
The process handle P refers to an active process and the specified thread does not exist. P
 
 
The buffer is not sufficient to hold the thread name.

Uncommitted

See LOCKING in libproc(3LIB).

libproc(3LIB), proc(4)
August 31, 2018 illumos