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

NAME


Plwp_stack, Plwp_alt_stack, Plwp_main_stack, Lstack, Lalt_stack,
Lmain_stack - get thread stack information

LIBRARY


Process Control Library (libproc, -lproc)

SYNOPSIS


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

DESCRIPTION


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.

RETURN VALUES


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.

ERRORS


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 The process handle P refers to a grabbed file, not
an active process or core.

EINVAL The process handle P refers to a core file and the
specified thread does not exist.

ENOENT 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:

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

INTERFACE STABILITY


Uncommitted

MT-LEVEL
See LOCKING in libproc(3LIB).

SEE ALSO


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

illumos May 11, 2016 illumos

tribblix@gmail.com :: GitHub :: Privacy