PTHREAD_ATTR_GETNAME_NP(3C) Standard C Library Functions PTHREAD_ATTR_GETNAME_NP(3C)

pthread_attr_getname_np, pthread_attr_setname_np
get or set thread name attribute

#include <pthread.h>
int
pthread_attr_getname_np(pthread_attr_t *restrict attr, char *name, size_t len);
int
pthread_attr_setname_np(pthread_attr_t *restrict attr, const char *name);

The pthread_attr_setname_np() and pthread_attr_getname_np() functions, respectively, set and get the thread name attribute in attr to name. For pthread_attr_getname_np(), len is the size of name. Any threads created with pthread_create(3c) using attr will have their name set to name upon creation.
Thread names are limited to PTHREAD_MAX_NAMELEN_NP including the terminating NUL. They may only contain printable ASCII characters.

Upon successful completion, the pthread_attr_getname_np() and pthread_attr_setname_np() functions return 0. Otherwise, an error number is returned to indicate the error.

The pthread_attr_getname_np() function may fail with:
 
 
The name argument is NULL.
 
 
The size of name as indicated by len is too small to contain the thread name. The buffer may be over-written with partial contents of the thread name.
The pthread_attr_setname_np() function may fail with:
 
 
The length of name given in name exceeds the maximum size allowed.

Uncommitted

MT-Safe

pthread_create(3c), pthread_getname_np(3c)
August 22, 2018 illumos