THR_GETNAME(3C) Standard C Library Functions THR_GETNAME(3C)

NAME


thr_getname, thr_setname - get or set the name of a thread

SYNOPSIS


#include <thread.h>

int
thr_getname(thread_t tid, char *name, size_t len);

int
thr_setname(thread_t tid, const char *name);

DESCRIPTION


The thr_getname() and thr_setname() functions, respectively, get and
set the names of the thread whose id is given by the tid parameter.
For thr_getname(), len indicates the size of name.

Thread names are limited to THREAD_NAME_MAX including the terminating
NUL. They may only contain printable ASCII characters.

To clear a thread name, call thr_setname() with NULL.

Unlike some other systems, threads do not inherit the process name by
default.

RETURN VALUES


Upon successful completion, the thr_getname() and thr_setname()
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,
thr_getname 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
thr_getname() 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 thr_setname() function will fail with:

ERANGE The length of name exceeds the maximum allowed size.

ESRCH The thread tid was not found.

INTERFACE STABILITY


Uncommitted

MT-LEVEL
MT-Safe

SEE ALSO


pthread_setname_np(3c), thr_create(3c)

illumos August 22, 2018 illumos

tribblix@gmail.com :: GitHub :: Privacy