1 PLWP_ITER(3PROC)       Process Control Library Functions      PLWP_ITER(3PROC)
   2 
   3 NAME
   4      Plwp_iter, Plwp_iter_all - iterate over threads
   5 
   6 LIBRARY
   7      Process Control Library (libproc, -lproc)
   8 
   9 SYNOPSIS
  10      #include <libproc.h>
  11 
  12      int
  13      Plwp_iter(struct ps_prochandle *P, proc_lwp_f *func, void *data);
  14 
  15      int
  16      Plwp_iter_all(struct ps_prochandle *P, proc_lwp_all_f *func, void *data);
  17 
  18 DESCRIPTION
  19      The Plwp_iter() and Plwp_iter_all() functions iterates over threads in
  20      the given process handle P.  The Plwp_iter() function iterates over all
  21      active threads, where as the Plwp_iter_all() function iterates over both
  22      active threads and zombie threads -- threads waiting to be reaped.
  23 
  24      For each thread, the callback function func is called with the pointer to
  25      the private data argument, data, and the thread's lwpstatus_t structure.
  26      In the case of the Plwp_iter_all() function, the thread's lwpsinfo_t is
  27      also included.
  28 
  29      The return value of func controls whether or not iteration continues.  If
  30      func returns 0, then both functions will continue iteration.  However, if
  31      func returns non-zero, then iteration will halt and that value will be
  32      used as the return value of the Plwp_iter() and Plwp_iter_all()
  33      functions.  Because both functions return -1 on internal failure, it is
  34      recommended that the callback function does not return -1 to indicate an
  35      error so that the caller may distinguish between the failure of the
  36      callback function and the failure of the Plwp_iter() and Plwp_iter_all()
  37      functions.
  38 
  39 RETURN VALUES
  40      Upon successful completion, the Plwp_iter() and Plwp_iter_all() functions
  41      return 0.  Otherwise, if there was an internal error or there is no
  42      thread data, then -1 is returned.  Otherwise, if the callback function
  43      func returns non-zero, then its return value will be returned instead.
  44 
  45 INTERFACE STABILITY
  46      Uncommitted
  47 
  48 MT-LEVEL
  49      See LOCKING in libproc(3LIB).
  50 
  51 SEE ALSO
  52      libproc(3LIB)
  53 
  54 illumos                          May 11, 2016                          illumos