PTHREAD_GETNAME_NP(3C) Standard C Library Functions PTHREAD_GETNAME_NP(3C)
NAME
pthread_getname_np,
pthread_setname_np - get or set the name of a
thread
SYNOPSIS
#include <pthread.h> int pthread_getname_np(
pthread_t tid,
char *name,
size_t len);
int pthread_setname_np(
pthread_t tid,
const char *name);
DESCRIPTION
The
pthread_getname_np() and
pthread_setname_np() functions,
respectively, get and set the names of the thread whose id is given by
the
tid parameter. For
pthread_getname_np(),
len indicates the size of
name.
Thread names are limited to PTHREAD_MAX_NAMELEN_NP including the
terminating NUL. They may only contain printable ASCII characters.
To clear a thread name, call
pthread_setname_np() with
NULL.
Unlike some other systems, threads do not inherit the process name by
default.
RETURN VALUES
Upon successful completion, the
pthread_getname_np() and
pthread_setname_np() functions return
0. Otherwise, an error number is
returned to indicate the error. If the thread identified by
tid does
not have a name set,
pthread_getname_np will be set to an empty string
(length = 0).
ERRORS
On failure, the contents of the buffer are undefined. Errors from
open(2),
read(2), or
write(2) are possible. In addition, the
pthread_getname_np() function will fail with:
EINVAL The
name argument is
NULL.
ERANGE The size of
name as given by
len was not large
enough to contain the name of the thread.
ESRCH The thread
tid was not found.
The
pthread_setname_np() function will fail with:
ERANGE The length of
name exceeds the maximum allowed size.
ESRCH The thread
tid was not found.
INTERFACE STABILITY
UncommittedMT-LEVEL MT-SafeSEE ALSO
pthread_attr_getname_np(3c), pthread_create(3c)
illumos August 22, 2018 illumos