1 PLWP_STACK(3PROC) Process Control Library Functions PLWP_STACK(3PROC) 2 3 NAME 4 Plwp_stack, Plwp_alt_stack, Plwp_main_stack, Lstack, Lalt_stack, 5 Lmain_stack - get thread stack information 6 7 LIBRARY 8 Process Control Library (libproc, -lproc) 9 10 SYNOPSIS 11 #include <libproc.h> 12 13 int 14 Plwp_stack(struct ps_prochandle *P, lwpid_t lwpid, stack_t *stkp); 15 16 int 17 Plwp_alt_stack(struct ps_prochandle *P, lwpid_t lwpid, stack_t *stkp); 18 19 int 20 Plwp_main_stack(struct ps_prochandle *P, lwpid_t lwpid, stack_t *stkp); 21 22 int 23 Lalt_stack(struct ps_lwphandle *L, stack_t *stkp); 24 25 int 26 Lmain_stack(struct ps_lwphandle *L, stack_t *stkp); 27 28 int 29 Lstack(struct ps_lwphandle *L, stack_t *stkp); 30 31 DESCRIPTION 32 The Plwp_stack(), Plwp_alt_stack(), and Plwp_main_stack() functions 33 obtain information about the size and address of the stacks for the 34 thread identified by lwpid in the process handle P. 35 36 Each thread in a process has its own stack which is used both for 37 maintaining function call sequences and the storing of local variables. 38 A thread may also configure a different stack to handle specific signals. 39 This stack is often called the alternate stack. Whether or not the 40 alternate stack is used may be controlled through the sigaction(2) and 41 sigaltstack(2) functions . 42 43 The Plwp_stack() function fills in stkp with the information about the 44 thread's currently executing stack, whether the alternate or main one. 45 46 The Plwp_alt_stack() function fills in stkp with the information about 47 the thread's alternate stack, if it's configured. 48 49 The Plwp_main_stack() function fills in stkp with the information about 50 the thread's main stack, regardless of if there is an alternate stack or 51 it is executing one. 52 53 Process handles that refer to files, obtained through Pgrab_file(3PROC), 54 do not have any stack information and these functions will always fail on 55 them. 56 57 The Lalt_stack(), Lmain_stack(), and Lstack() functions are identical to 58 the Plwp_alt_stack(), Plwp_main_stack(), and Plwp_main_stack() functions, 59 except rather than specifying a thread to operate on, they operate on the 60 thread handle L, which specifies the thread to operate on. 61 62 RETURN VALUES 63 Upon successful completion, the Plwp_stack(), Plwp_alt_stack(), 64 Plwp_main_stack(), Lalt_stack(), Lmain_stack(), and Lstack() functions 65 return 0 and fills in stkp with information about the appropriate stack. 66 Otherwise, -1 is returned, errno is updated with the error, and stkp is 67 not modified. 68 69 ERRORS 70 For a full list of possible errors also see the DIAGNOSTICS section in 71 proc(4). 72 73 The Plwp_stack(), Plwp_alt_stack(), and Plwp_main_stack() function will 74 fail if: 75 76 ENODATA The process handle P refers to a grabbed file, not an 77 active process or core. 78 79 EINVAL The process handle P refers to a core file and the 80 specified thread does not exist. 81 82 ENOENT The process handle P refers to an active process and 83 the specified thread does not exist. 84 85 The Plwp_alt_stack() and Lalt_stack() functions will fail if: 86 87 ENODATA The thread identified by lwpid did not have an 88 alternate stack enabled. 89 90 INTERFACE STABILITY 91 Uncommitted 92 93 MT-LEVEL 94 See LOCKING in libproc(3LIB). 95 96 SEE ALSO 97 sigaction(2), sigaltstack(2), libproc(3LIB), proc(4) 98 99 illumos May 11, 2016 illumos