Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Plwp_iter_all (3PROC)

Name

Plwp_iter, Plwp_iter_all - walk the lwps of a victim process

Synopsis

#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);

Description

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.

Return Values

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.

Errors

On failure, these errno values may be set:

EAGAIN

Process has been lost to control, needs the Preopen() function

EBUSY

Process is not stopped (Psetrun())

EINTR

Signal received while waiting for stop

EINVAL

Invalid argument

ENOENT

The victim process has terminated

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Unsafe

See Also

libproc.h(3HEAD), libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), proc(5)