Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Thursday, June 13, 2019
 
 

Pstatus (3PROC)

Name

Pstatus, Ppsinfo, Paction, Pnsig, Pdlt, Pfdinfolist - return various/proc structures

Synopsis

#include <libproc.h>
const pstatus_t *Pstatus(ps_prochandle_t *Pr);
const psinfo_t *Ppsinfo(ps_prochandle_t *Pr);
struct sigaction *Paction(ps_prochandle_t *Pr);
int Pnsig(ps_prochandle_t *Pr);
int Pldt(ps_prochandle_t *Pr, struct ssd *pldt, int nldt);
fdinfo_list_t *Pfdinfolist(ps_prochandle_t *Pr);

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 Pstatus() function returns a pointer to the pstatus_t structure that is maintained inside the library for the victim process. Its contents are reliable only when the victim process is stopped. Its contents change when the victim process is caused to run and then stopped again. For more information, see the Psetrun(3PROC) and Pwait(3PROC) man pages.

The Ppsinfo() function returns a pointer to the psinfo_t structure that is maintained inside the library for the victim process. Its contents are refreshed only when the Ppsinfo() function is called.

The Paction() function returns a pointer to the array of signal actions known to the kernel. Every call to the Paction() function for a live process will refresh the array to contain the current signal actions.

The Pnsig() function returns the number of signals known to the kernel and is the size of the array returned by the Paction() function.

The x86-only Pldt() function retrieves the process or core file LDT structures. If the nldt argument is zero, then the Pldt() function returns the actual number of LDT entries available. Else, the Pldt() function retrieves at most nldt number of LDT entries into the pldt array and returns the actual number of entries retrieved.

The Pfdinfolist() function returns a pointer to a linked list of fdinfo_list_t structures, each of which contains a pointer to a prfdinfo_t structure describing one open file in the victim process.

Return Values

On successful completion, the Pstatus() function returns a pointer to the pstatus_t structure of the victim. On error, it returns NULL and sets errno to indicate the error.

On successful completion, the Ppsinfo() function returns a pointer to the psinfo_t structure of the victim. On error, it returns NULL and sets errno to indicate the error.

On successful completion, the Paction() function returns a pointer to the signal actions of the victim. On error, it returns NULL and sets errno to indicate the error.

The Pnsig() function returns the maximum number of signals. It has no error return.

On successful completion, the Pldt() function returns the number of LDT entries read into the pldt buffer. If the nldt argument is zero, it returns the number of entries required for a real call to the Pldt() function. On error, it returns -1 and sets errno to indicate the error.

On successful completion, the Pfdinfolist() function returns a pointer to the linked list of file descriptor descriptions. On error, it returns NULL and sets 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)