1 PTHREAD_ATTR_GETNAME_NP(3C) Standard C Library Functions 2 3 NAME 4 pthread_attr_getname_np, pthread_attr_setname_np - get or set thread name 5 attribute 6 7 SYNOPSIS 8 #include <pthread.h> 9 10 int 11 pthread_attr_getname_np(pthread_attr_t *restrict attr, char *name, 12 size_t len); 13 14 int 15 pthread_attr_setname_np(pthread_attr_t *restrict attr, const char *name); 16 17 DESCRIPTION 18 The pthread_attr_setname_np() and pthread_attr_getname_np() functions, 19 respectively, set and get the thread name attribute in attr to name. For 20 pthread_attr_getname_np(), len is the size of name. Any threads created 21 with pthread_create(3c) using attr will have their name set to name upon 22 creation. 23 24 Thread names are limited to PTHREAD_MAX_NAMELEN_NP including the 25 terminating NUL. They may only contain printable ASCII characters. 26 27 RETURN VALUES 28 Upon successful completion, the pthread_attr_getname_np() and 29 pthread_attr_setname_np() functions return 0. Otherwise, an error number 30 is returned to indicate the error. 31 32 ERRORS 33 The pthread_attr_getname_np() function may fail with: 34 35 EINVAL The name argument is NULL. 36 37 ERANGE The size of name as indicated by len is too small to 38 contain the thread name. The buffer may be over- 39 written with partial contents of the thread name. 40 41 The pthread_attr_setname_np() function may fail with: 42 43 ERANGE The length of name given in name exceeds the maximum 44 size allowed. 45 46 INTERFACE STABILITY 47 Uncommitted 48 49 MT-LEVEL 50 MT-Safe 51 52 SEE ALSO 53 pthread_create(3c), pthread_getname_np(3c) 54 55 illumos August 22, 2018 illumos