Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3proc/Pstack_iter.3proc.man.txt
+++ new/usr/src/man/man3proc/Pstack_iter.3proc.man.txt
1 1 PSTACK_ITER(3PROC) Process Control Library Functions PSTACK_ITER(3PROC)
2 2
3 3 NAME
4 4 Pstack_iter - iterate process stack frames
5 5
6 -SYNOPSIS
6 +LIBRARY
7 7 Process Control Library (libproc, -lproc)
8 +
9 +SYNOPSIS
8 10 #include <libproc.h>
9 11
10 12 int
11 13 Pstack_iter(struct ps_prochandle *P, const prgregset_t regs,
12 14 proc_stack_f *func, void *data);
13 15
14 16 DESCRIPTION
15 17 The Pstack_iter() function iterates over the stack frames in the process
16 18 P starting at the point defined by regs.
17 19
18 20 For each valid stack frame encountered, the callback function func is
19 21 invoked with data passed as argument. The full signature of proc_stack_f
20 22 is defined in libproc(3LIB). With each callback, a register set,
21 23 argument set, and argument count will be provided. In that register set,
22 24 only a subset of the registers will be valid, which include the frame
23 25 pointer, program counter, and on SPARC systems, the next program counter.
24 26 These registers can be accessed with the constants R_FP, R_PC, and R_nPC
25 27 respectively. These correspond to the registers %ebp and %eip on i386,
26 28 %rbp and %rip on amd64, %fp, %pc, and %npc on both SPARC and SPARCv9.
27 29
28 30 Callers will receive a callback for the first stack frame indicated by
29 31 regs and then will receive a subsequent callback for each caller of that
30 32 frame until no such frame can be found. Stack frames that logically come
31 33 after the frame indicated by regs will not receive callbacks.
32 34
33 35 The compiler can either facilitate or stymie the iteration of the stack.
34 36 Programs that have been compiled in such a way as to omit the frame
35 37 pointer will result in truncated stacks. Similarly, if the initial set
36 38 of registers passed in via regs is invalid, then the ability to iterate
37 39 the stack will be limited. The return value of func controls whether or
38 40 not iteration continues. If func returns 0 then iteration continues.
39 41 However, if func returns non-zero, then iteration will halt and that
40 42 value will be used as the return value of the Pstack_iter() function.
41 43 Because Pstack_iter() returns -1 on internal failure it is recommended
42 44 the callback function not return -1 to indicate an error. Thus the
43 45 caller may distinguish between the failure of the callback function and
44 46 the failure of the Pstack_iter() function.
45 47
46 48 RETURN VALUES
47 49 Upon successful completion, the Pstack_iter() function returns 0. If
48 50 there was an internal error then -1 is returned. Otherwise, if the
49 51 callback function func returns non-zero, then its return value will be
50 52 returned instead.
51 53
52 54 INTERFACE STABILITY
53 55 Uncommitted
54 56
55 57 MT-LEVEL
56 58 See LOCKING in libproc(3LIB).
57 59
58 60 SEE ALSO
59 61 libproc(3LIB), proc(4)
60 62
61 63 illumos May 11, 2016 illumos
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX