PLWP_ITER(3PROC) Process Control Library Functions PLWP_ITER(3PROC)
NAME
Plwp_iter,
Plwp_iter_all - iterate over threads
LIBRARY
Process Control Library (libproc, -lproc)
SYNOPSIS
#include <libproc.h> int Plwp_iter(
struct ps_prochandle *P,
proc_lwp_f *func,
void *data);
int Plwp_iter_all(
struct ps_prochandle *P,
proc_lwp_all_f *func,
void *data);
DESCRIPTION
The
Plwp_iter() and
Plwp_iter_all() functions iterates over threads in
the given process handle
P. The
Plwp_iter() function iterates over all
active threads, where as the
Plwp_iter_all() function iterates over
both active threads and zombie threads -- threads waiting to be reaped.
For each thread, the callback function
func is called with the pointer
to the private data argument,
data, and the thread's
lwpstatus_t structure. In the case of the
Plwp_iter_all() function, the thread's
lwpsinfo_t is also included.
The return value of
func controls whether or not iteration continues.
If
func returns
0, then both functions will continue iteration.
However, if
func returns non-zero, then iteration will halt and that
value will be used as the return value of the
Plwp_iter() and
Plwp_iter_all() functions. Because both functions return
-1 on
internal failure, it is recommended that the callback function does not
return
-1 to indicate an error so that the caller may distinguish
between the failure of the callback function and the failure of the
Plwp_iter() and
Plwp_iter_all() functions.
RETURN VALUES
Upon successful completion, the
Plwp_iter() and
Plwp_iter_all()
functions return
0. Otherwise, if there was an internal error or there
is no thread data, then
-1 is returned. Otherwise, if the callback
function
func returns non-zero, then its return value will be returned
instead.
INTERFACE STABILITY
UncommittedMT-LEVEL See
LOCKING in
libproc(3LIB).
SEE ALSO
libproc(3LIB)illumos May 11, 2016 illumos