PLWP_STACK(3PROC) Process Control Library Functions PLWP_STACK(3PROC)

Plwp_stack, Plwp_alt_stack, Plwp_main_stack, Lstack, Lalt_stack, Lmain_stackget thread stack information

Process Control Library (libproc, -lproc)

#include <libproc.h>

int
Plwp_stack(struct ps_prochandle *P, lwpid_t lwpid, stack_t *stkp);

int
Plwp_alt_stack(struct ps_prochandle *P, lwpid_t lwpid, stack_t *stkp);

int
Plwp_main_stack(struct ps_prochandle *P, lwpid_t lwpid, stack_t *stkp);

int
Lalt_stack(struct ps_lwphandle *L, stack_t *stkp);

int
Lmain_stack(struct ps_lwphandle *L, stack_t *stkp);

int
Lstack(struct ps_lwphandle *L, stack_t *stkp);

The (), Plwp_alt_stack(), and Plwp_main_stack() functions obtain information about the size and address of the stacks for the thread identified by lwpid in the process handle P.

Each thread in a process has its own stack which is used both for maintaining function call sequences and the storing of local variables. A thread may also configure a different stack to handle specific signals. This stack is often called the . Whether or not the alternate stack is used may be controlled through the sigaction(2) and sigaltstack(2) functions .

The () function fills in stkp with the information about the thread's currently executing stack, whether the alternate or main one.

The () function fills in stkp with the information about the thread's alternate stack, if it's configured.

The () function fills in stkp with the information about the thread's main stack, regardless of if there is an alternate stack or it is executing one.

Process handles that refer to files, obtained through Pgrab_file(3PROC), do not have any stack information and these functions will always fail on them.

The (), (), and () functions are identical to the Plwp_alt_stack(), Plwp_main_stack(), and Plwp_main_stack() functions, except rather than specifying a thread to operate on, they operate on the thread handle L, which specifies the thread to operate on.

Upon successful completion, the Plwp_stack(), Plwp_alt_stack(), Plwp_main_stack(), Lalt_stack(), Lmain_stack(), and Lstack() functions return and fills in stkp with information about the appropriate stack. Otherwise, is returned, is updated with the error, and stkp is not modified.

For a full list of possible errors also see the section in proc(5).

The Plwp_stack(), Plwp_alt_stack(), and Plwp_main_stack() function will fail if:

The process handle P refers to a grabbed file, not an active process or core.
The process handle P refers to a core file and the specified thread does not exist.
The process handle P refers to an active process and the specified thread does not exist.

The Plwp_alt_stack() and Lalt_stack() functions will fail if:

The thread identified by lwpid did not have an alternate stack enabled.

See in libproc(3LIB).

sigaction(2), sigaltstack(2), libproc(3LIB), proc(5)

May 11, 2016 OmniOS