1 THR_GETNAME(3C)          Standard C Library Functions          THR_GETNAME(3C)
   2 
   3 NAME
   4      thr_getname, thr_setname - get or set the name of a thread
   5 
   6 SYNOPSIS
   7      #include <thread.h>
   8 
   9      int
  10      thr_getname(thread_t tid, char *name, size_t len);
  11 
  12      int
  13      thr_setname(thread_t tid, const char *name);
  14 
  15 DESCRIPTION
  16      The thr_getname() and thr_setname() functions, respectively, get and set
  17      the names of the thread whose id is given by the tid parameter.  For
  18      thr_getname(), len indicates the size of name.
  19 
  20      Thread names are limited to THREAD_NAME_MAX including the terminating
  21      NUL.  They may only contain printable ASCII characters.
  22 
  23      To clear a thread name, call thr_setname() with NULL.
  24 
  25      Unlike some other systems, threads do not inherit the process name by
  26      default.
  27 
  28 RETURN VALUES
  29      Upon successful completion, the thr_getname() and thr_setname() functions
  30      return 0.  Otherwise, an error number is returned to indicate the error.
  31      If the thread identified by tid does not have a name set, thr_getname
  32      will be set to an empty string (length = 0).
  33 
  34 ERRORS
  35      On failure, the contents of the buffer are undefined.  Errors from
  36      open(2), read(2), or write(2) are possible.  In addition, the
  37      thr_getname() function will fail with:
  38 
  39      EINVAL             The name argument is NULL.
  40 
  41      ERANGE             The size of name as given by len was not large enough
  42                         to contain the name of the thread.
  43 
  44      ESRCH              The thread tid was not found.
  45 
  46      The thr_setname() function will fail with:
  47 
  48      ERANGE             The length of name exceeds the maximum allowed size.
  49 
  50      ESRCH              The thread tid was not found.
  51 
  52 INTERFACE STABILITY
  53      Uncommitted
  54 
  55 MT-LEVEL
  56      MT-Safe
  57 
  58 SEE ALSO
  59      pthread_setname_np(3c), thr_create(3c)
  60 
  61 illumos                         August 22, 2018                        illumos