8498 ficl: variable 'count' might be clobbered by 'longjmp' or 'vfork'
[unleashed.git] / share / man / man3c / thr_stksegment.3c
blob8bf64d008257ef99d3b256c65e98a2fcb92ef0ad
1 '\" te
2 .\"  Copyright (c) 2000 Sun Microsystems, Inc. - All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH THR_STKSEGMENT 3C "Jun 15, 2000"
7 .SH NAME
8 thr_stksegment \- get thread stack address and size
9 .SH SYNOPSIS
10 .LP
11 .nf
12 cc -mt [ \fIflag\fR... ] \fIfile\fR...[ \fIlibrary\fR... ]
13 #include <thread.h>
14 #include <signal.h>
16 \fBint\fR \fBthr_stksegment\fR(\fBstack_t *\fR\fIss\fR);
17 .fi
19 .SH DESCRIPTION
20 .sp
21 .LP
22 The \fBthr_stksegment()\fR function returns, in its \fBstack_t\fR argument, the
23 address and size of the calling thread's stack.
24 .sp
25 .LP
26 The \fBstack_t\fR structure includes the following members:
27 .sp
28 .in +2
29 .nf
30 void   *ss_sp
31 size_t ss_size
32 int    ss_flags
33 .fi
34 .in -2
36 .sp
37 .LP
38 On successful return from \fBthr_stksegment()\fR, \fBss_sp\fR contains the high
39 address of the caller's stack and \fBss_size\fR contains the size of the stack
40 in bytes.  The \fBss_flags\fR member is always 0. Note that the meaning of
41 \fBss_sp\fR is reversed from other uses of \fBstack_t\fR such as
42 \fBsigaltstack\fR(2) where \fBss_sp\fR is the low address.
43 .sp
44 .LP
45 The stack information provided by \fBthr_stksegment()\fR is typically used by
46 debuggers, garbage collectors, and similar applications. Most applications
47 should not require such information.
48 .SH RETURN VALUES
49 .sp
50 .LP
51 The  \fBthr_stksegment()\fR function returns  \fB0\fR if the thread stack
52 address and size were successfully retrieved.  Otherwise, it returns a non-zero
53 error value.
54 .SH ERRORS
55 .sp
56 .LP
57 The  \fBthr_stksegment()\fR function will fail if:
58 .sp
59 .ne 2
60 .na
61 \fB\fBEAGAIN\fR \fR
62 .ad
63 .RS 11n
64 The stack information for the thread is not available because the thread's
65 initialization is not yet complete, or the thread is an internal thread.
66 .RE
68 .SH ATTRIBUTES
69 .sp
70 .LP
71 See \fBattributes\fR(5) for descriptions of the following attributes:
72 .sp
74 .sp
75 .TS
76 box;
77 c | c
78 l | l .
79 ATTRIBUTE TYPE  ATTRIBUTE VALUE
81 MT-Level        MT-Safe
82 .TE
84 .SH SEE ALSO
85 .sp
86 .LP
87 \fBsigaltstack\fR(2), \fBthr_create\fR(3C), \fBattributes\fR(5)