PLWP_STACK(3PROC) | Process Control Library Functions | PLWP_STACK(3PROC) |
Plwp_stack
,
Plwp_alt_stack
,
Plwp_main_stack
, Lstack
,
Lalt_stack
, Lmain_stack
— get 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_stack
(),
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 alternate stack. Whether or not the alternate stack is used may be controlled through the sigaction(2) and sigaltstack(2) functions .
The
Plwp_stack
()
function fills in stkp with the information about the
thread's currently executing stack, whether the alternate or main one.
The
Plwp_alt_stack
()
function fills in stkp with the information about the
thread's alternate stack, if it's configured.
The
Plwp_main_stack
()
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
Lalt_stack
(),
Lmain_stack
(),
and
Lstack
()
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
0 and fills in
stkp with information about the appropriate stack.
Otherwise, -1 is
returned,
errno is
updated with the error, and stkp is not modified.
For a full list of possible errors also see the DIAGNOSTICS section in proc(5).
The Plwp_stack
(),
Plwp_alt_stack
(), and
Plwp_main_stack
() function will fail if:
ENODATA
EINVAL
ENOENT
The Plwp_alt_stack
() and
Lalt_stack
() functions will fail if:
ENODATA
See LOCKING in libproc(3LIB).
May 11, 2016 | OmniOS |