Plwp_iter, Plwp_iter_all - walk the lwps of a victim process
#include <libproc.h>
typedef int proc_lwp_f(void *cd, const lwpstatus_t *);
int Plwp_iter(ps_prochandle_t *Pr, proc_lwp_f *func, void *cd);
typedef int proc_lwp_all_f(void *cd, const lwpstatus_t *, const lwpsinfo_t *);
int Plwp_iter_all(ps_prochandle_t *Pr, proc_lwp_all_f *func, void *cd);
The Pr argument identifies a victim process or core file attached to the controlling process by the create and grab interfaces. For more information, see the Pcreate(3PROC) and Pgrab(3PROC) man pages.
The Plwp_iter() function iterates over all lwps that are not zombie lwps in the victim process, and calls the specified function for each such lwp, passing it the specified cd argument and a pointer to the lwpstatus_t structure for the individual lwp. The iteration is terminated if the specified function returns a value that is not zero.
The Plwp_iter_all() function iterates over all lwps in the process, including zombie lwps, and calls the specified function for each lwp, passing it the specified cd argument plus pointers to the lwpstatus_t structure and the lwpsinfo_t structure for the individual lwp. If the lwp is a zombie lwp, the pointer to the lwpstatus_t structure will be NULL. The iteration is terminated if the specified function returns a value that is not zero.
On successful completion, the Plwp_iter() and Plwp_iter_all() functions return 0 or the first non-zero value returned by the specified callback function. On error, they return -1 and set errno to indicate the error.
On failure, these errno values may be set:
Process has been lost to control, needs the Preopen() function
Process is not stopped (Psetrun())
Signal received while waiting for stop
Invalid argument
The victim process has terminated
See attributes(7) for descriptions of the following attributes:
|
libproc.h(3HEAD), libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), proc(5)