2 .\" Copyright (c) 2001, Michael Kerrisk (mtk.manpages@gmail.com)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" aeb, various minor fixes
26 .\" Japanese Version Copyright (c) 2001 Yuichi SATO
27 .\" all rights reserved.
28 .\" Translated 2001-11-04, Yuichi SATO <ysato@h4.dion.ne.jp>
29 .\" Updated 2001-12-09, Yuichi SATO
30 .\" Updated 2005-11-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
31 .\" Updated 2006-01-04, Akihiro MOTOKI, Catch up to LDP 2.20
33 .\"WORD: alternate signal stack ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯
34 .\"WORD: establish (¥¹¥¿¥Ã¥¯¤Î) ³ÎΩ
36 .TH SIGALTSTACK 2 2008-10-04 "Linux" "Linux Programmer's Manual"
39 .\"O sigaltstack \- set and/or get signal stack context
40 sigaltstack \- ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Î¥³¥ó¥Æ¥¥¹¥È¤òÀßÄꡦ¼èÆÀ¤¹¤ë
43 .B #include <signal.h>
45 .BI "int sigaltstack(const stack_t *" ss ", stack_t *" oss );
48 .\"O Feature Test Macro Requirements for glibc (see
49 .\"O .BR feature_test_macros (7)):
50 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
51 .RB ( feature_test_macros (7)
56 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
59 .\" _BSD_SOURCE || _XOPEN_SOURCE >= 500
62 .\"O .BR sigaltstack ()
63 .\"O allows a process to define a new alternate
64 .\"O signal stack and/or retrieve the state of an existing
65 .\"O alternate signal stack.
66 .\"O An alternate signal stack is used during the
67 .\"O execution of a signal handler if the establishment of that handler (see
68 .\"O .BR sigaction (2))
72 ¥×¥í¥»¥¹¤Ï¿·¤·¤¤ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤òÄêµÁ¤·¤¿¤ê¡¢
73 ´û¸¤ÎÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Î¾õÂÖ¤ò¼èÆÀ¤Ç¤¤ë¡£
74 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤¬ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤òÍ׵᤹¤ë¤è¤¦¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¤È
76 »²¾È)¡¢¥Ï¥ó¥É¥é¤Î¼Â¹ÔÃæ¤Ï¤½¤Î¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤¬»È¤ï¤ì¤ë¡£
78 .\"O The normal sequence of events for using an alternate signal stack
79 .\"O is the following:
80 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ò»È¤¦ºÝ¤Î°ìÈÌŪ¤Ê¼ê½ç¤Ï¡¢°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë:
83 .\"O Allocate an area of memory to be used for the alternate
85 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Ç»È¤¦¥á¥â¥êÎΰè¤ò³ÎÊݤ¹¤ë¡£
89 .\"O .BR sigaltstack ()
90 .\"O to inform the system of the existence and
91 .\"O location of the alternate signal stack.
94 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Î¸ºß¤È¾ì½ê¤ò¥·¥¹¥Æ¥à¤ËÃΤ餻¤ë¡£
97 .\"O When establishing a signal handler using
98 .\"O .BR sigaction (2),
99 .\"O inform the system that the signal handler should be executed
100 .\"O on the alternate signal stack by
101 .\"O specifying the \fBSA_ONSTACK\fP flag.
103 ¤ò»È¤Ã¤Æ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ò³ÎΩ¤¹¤ëºÝ¡¢
104 \fBSA_ONSTACK\fP ¥Õ¥é¥°¤ò»ØÄꤹ¤ë¤³¤È¤Ë¤è¤ê¡¢
105 ¤½¤Î¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤òÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¾å¤Ç¼Â¹Ô¤¹¤ë¤³¤È¤ò
108 .\"O The \fIss\fP argument is used to specify a new
109 .\"O alternate signal stack, while the \fIoss\fP argument
110 .\"O is used to retrieve information about the currently
111 .\"O established signal stack.
112 \fIss\fP °ú¤¿ô¤Ï¡¢¿·¤·¤¤¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ò»ØÄꤹ¤ë¤¿¤á¤Ë»È¤¦¡£
113 ¤Þ¤¿ \fIoss\fP °ú¤¿ô¤Ï¡¢¸½ºß³ÎΩ¤µ¤ì¤Æ¤¤¤ë
114 ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Ë»È¤¦¡£
115 .\"O If we are interested in performing just one
116 .\"O of these tasks then the other argument can be specified as NULL.
117 .\"O Each of these arguments is a structure of the following type:
118 ¤³¤ÎÁàºî¤Î¤¦¤Á 1 ¤Ä¤À¤±¤ò¼Â¹Ô¤µ¤»¤ë¤Ë¤Ï¡¢
119 »ÈÍѤ·¤Ê¤¤°ú¤¿ô¤ò NULL ¤Ë»ØÄꤹ¤ì¤Ð¤è¤¤¡£
120 °ú¤¿ô¤È¤Ê¤ë¹½Â¤ÂΤϡ¢°Ê²¼¤Î¤è¤¦¤Ê·¿¤Ç¤¢¤ë:
125 .\"O void *ss_sp; /* Base address of stack */
126 void *ss_sp; /* ¥¹¥¿¥Ã¥¯¤Î¥Ù¡¼¥¹¥¢¥É¥ì¥¹ */
127 .\"O int ss_flags; /* Flags */
128 int ss_flags; /* ¥Õ¥é¥° */
129 .\"O size_t ss_size; /* Number of bytes in stack */
130 size_t ss_size; /* ¥¹¥¿¥Ã¥¯¤Î¥Ð¥¤¥È¿ô */
135 .\"O To establish a new alternate signal stack,
136 .\"O \fIss.ss_flags\fP is set to zero, and \fIss.ss_sp\fP and
137 .\"O \fIss.ss_size\fP specify the starting address and size of
139 ¿·µ¬¤ÎÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ò³ÎΩ¤¹¤ë¤Ë¤Ï¡¢
140 \fIss.ss_flags\fP ¤ò 0 ¤ËÀßÄꤷ¡¢
141 \fIss.ss_sp\fP ¤È \fIss.ss_size\fP ¤Ë
142 ¥¹¥¿¥Ã¥¯¤Î³«»Ï¥¢¥É¥ì¥¹¤È¥¹¥¿¥Ã¥¯¥µ¥¤¥º¤ò»ØÄꤹ¤ë¡£
143 .\"O The constant \fBSIGSTKSZ\fP is defined to be large enough
144 .\"O to cover the usual size requirements for an alternate signal stack,
145 .\"O and the constant \fBMINSIGSTKSZ\fP defines the minimum
146 .\"O size required to execute a signal handler.
147 Äê¿ô \fBSIGSTKSZ\fP ¤Ï¡¢ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤¬Ä̾ïɬÍפ¹¤ë
148 ¥µ¥¤¥º¤è¤ê¤â½¼Ê¬Â礤¯ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
149 ¤Þ¤¿Äê¿ô \fBMINSIGSTKSZ\fP ¤Ï¡¢
150 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Î¼Â¹Ô¤ËɬÍפʺǾ®¥µ¥¤¥º¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
152 .\"O When a signal handler is invoked on the alternate stack,
153 .\"O the kernel automatically aligns the address given in \fIss.ss_sp\fP
154 .\"O to a suitable address boundary for the underlying hardware architecture.
155 ÂåÂØ¥¹¥¿¥Ã¥¯¤Ç¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤¬µ¯Æ°¤µ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢
156 ¥«¡¼¥Í¥ë¤Ë¤è¤ê¼«Æ°Åª¤Ë¡¢\fIss.ss_sp\fP ¤Ç»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹¤Ï
157 Æ°ºî¤·¤Æ¤¤¤ë¥Ï¡¼¥É¥¦¥§¥¢¥¢¡¼¥¥Æ¥¯¥Á¥ã¤ËŬ¤·¤¿¥¢¥É¥ì¥¹¶³¦¤Ë
160 .\"O To disable an existing stack, specify \fIss.ss_flags\fP
161 .\"O as \fBSS_DISABLE\fP.
162 .\"O In this case, the remaining fields
163 .\"O in \fIss\fP are ignored.
164 ´û¸¤Î¥¹¥¿¥Ã¥¯¤ò̵¸ú¤Ë¤¹¤ë¤Ë¤Ï¡¢
165 \fIss.ss_flags\fP ¤ò \fBSS_DISABLE\fP ¤Ë»ØÄꤹ¤ë¡£
166 ¤³¤Î¾ì¹ç¡¢\fIss\fP ¤Î¾¤Î¥Õ¥£¡¼¥ë¥É¤Ï̵»ë¤µ¤ì¤ë¡£
168 .\"O If \fIoss\fP is not NULL, then it is used to return information about
169 .\"O the alternate signal stack which was in effect prior to the
171 .\"O .BR sigaltstack ().
172 \fIoss\fP ¤¬ NULL °Ê³°¤Î¾ì¹ç¡¢
173 \fIoss\fP ¤ËÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Î¾ðÊó¤¬ÊÖ¤µ¤ì¤ë¡£
176 ¤Î¸Æ¤Ó½Ð¤·¤è¤êÀè¤Ë¹Ô¤ï¤ì¤ë¡£
177 .\"O The \fIoss.ss_sp\fP and \fIoss.ss_size\fP fields return the starting
178 .\"O address and size of that stack.
179 .\"O The \fIoss.ss_flags\fP may return either of the following values:
180 \fIoss.ss_sp\fP ¤È \fIoss.ss_size\fP ¥Õ¥£¡¼¥ë¥É¤Ë
181 ¥¹¥¿¥Ã¥¯¤Î³«»Ï¥¢¥É¥ì¥¹¤È¥¹¥¿¥Ã¥¯¥µ¥¤¥º¤¬ÊÖ¤µ¤ì¤ë¡£
182 \fIoss.ss_flags\fP ¤Ë¤Ï°Ê²¼¤Î¤É¤Á¤é¤«¤ÎÃͤ¬ÊÖ¤µ¤ì¤ë:
185 .\"O The process is currently executing on the alternate signal stack.
186 .\"O (Note that it is not possible
187 .\"O to change the alternate signal stack if the process is
188 .\"O currently executing on it.)
189 ¥×¥í¥»¥¹¤¬ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¾å¤Ç¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë
190 (¥×¥í¥»¥¹¤¬´û¤Ë¤½¤Î¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¾å¤Ç¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢
191 ¤½¤ì¤ÈƱ¤¸¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Ë¤ÏÊѹ¹¤Ç¤¤Ê¤¤ÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È)¡£
194 .\"O The alternate signal stack is currently disabled.
195 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤¬¸½ºß̵¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
196 .\"O .SH "RETURN VALUE"
198 .\"O .BR sigaltstack ()
199 .\"O returns 0 on success, or \-1 on failure with
200 .\"O \fIerrno\fP set to indicate the error.
202 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç 0 ¤òÊÖ¤¹¡£
203 ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¤Æ¡¢
204 ¥¨¥é¡¼¤ò¼¨¤¹ÃÍ¤Ë \fIerrno\fP ¤òÀßÄꤹ¤ë¡£
209 .\"O Either \fIss\fP or \fIoss\fP is not NULL and points to an area
210 .\"O outside of the process's address space.
211 \fIss\fP ¤Þ¤¿¤Ï \fIoss\fP ¤Î¤É¤Á¤é¤¬¡¢NULL °Ê³°¤Ç¡¢
212 ¤«¤Ä¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Î³°¤ò»Ø¤·¤Æ¤¤¤ë¡£
215 .\"O \fIss\fP is not NULL and the \fIss_flags\fP field contains
216 .\"O a nonzero value other than
217 .\"O .BR SS_DISABLE .
218 \fIss\fP ¤¬ NULL °Ê³°¤Ç¡¢\fIss_flags\fP ¥Õ¥£¡¼¥ë¥É¤¬
220 °Ê³°¤Î 0 ¤Ç¤Ê¤¤ÃͤˤʤäƤ¤¤ë¡£
223 .\"O The specified size of the new alternate signal stack
224 .\"O (\fIss.ss_size\fP) was less than \fBMINSTKSZ\fP.
225 ¿·¤·¤¤ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯ (\fIss.ss_size\fP) ¤Ë»ØÄꤷ¤¿¥µ¥¤¥º¤¬
226 \fBMINSTKSZ\fP ¤è¤ê¾®¤µ¤¤¡£
229 .\"O An attempt was made to change the alternate signal stack while
230 .\"O it was active (i.e., the process was already executing
231 .\"O on the current alternate signal stack).
232 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤¬Í¸ú¤Ç¤¢¤ë¤È¤¤ËÊѹ¹¤ò¹Ô¤ª¤¦¤È¤·¤¿
233 (¤Ä¤Þ¤ê¡¢¥×¥í¥»¥¹¤¬´û¤Ë¸½ºß¤ÎÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¾å¤Ç¼Â¹Ô¤µ¤ì¤Æ¤¤¤¿)¡£
234 .\"O .SH "CONFORMING TO"
236 SUSv2, SVr4, POSIX.1-2001.
239 .\"O The most common usage of an alternate signal stack is to handle the
241 .\"O signal that is generated if the space available for the
242 .\"O normal process stack is exhausted: in this case, a signal handler for
244 .\"O cannot be invoked on the process stack; if we wish to handle it,
245 .\"O we must use an alternate signal stack.
246 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ò»ÈÍѤ¹¤ëºÇ¤â¤è¤¯¤¢¤ë¾ìÌ̤ϡ¢
248 ¥·¥°¥Ê¥ë¤ò°·¤¦¤È¤¤Ç¤¢¤ë¡£
250 ¤Ï¥×¥í¥»¥¹¤ÎÄ̾ï¤Î¥¹¥¿¥Ã¥¯¤¬ÍøÍѤǤ¤ë¶õ´Ö¤¬»È¤¤²Ì¤¿¤µ¤ì¤¿ºÝ¤Ë
251 À¸À®¤µ¤ì¤ë¥·¥°¥Ê¥ë¤Ç¤¢¤ë¡£¤³¤Î¾ì¹ç¤Ë¤Ï¡¢
253 ÍѤΥ·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ò¥×¥í¥»¥¹¤Î¥¹¥¿¥Ã¥¯¾å¤Ç¤Ïµ¯Æ°¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£
254 ¤½¤Î¤¿¤á¡¢¤³¤Î¥·¥°¥Ê¥ë¤ò°·¤ª¤¦¤È¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢
255 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ò»ÈÍѤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
257 .\"O Establishing an alternate signal stack is useful if a process
258 .\"O expects that it may exhaust its standard stack.
259 ¥×¥í¥»¥¹¤¬É¸½à¤Î¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ò»È¤¤²Ì¤¿¤¹¤³¤È¤¬Í½ÁÛ¤µ¤ì¤ë¾ì¹ç¤Ï¡¢
260 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ò³ÎΩ¤¹¤ë¤ÈÊØÍø¤Ç¤¢¤ë¡£
261 .\"O This may occur, for example, because the stack grows so large
262 .\"O that it encounters the upwardly growing heap, or it reaches a
263 .\"O limit established by a call to \fBsetrlimit(RLIMIT_STACK, &rlim)\fP.
264 Î㤨¤Ð¡¢¥¹¥¿¥Ã¥¯¤¬ºÇ¾å°Ì¥¢¥É¥ì¥¹¤«¤é
265 ²¼°Ì¥¢¥É¥ì¥¹Êý¸þ¤ËÈó¾ï¤Ë¤¿¤¯¤µ¤óÀѤޤì¤Æ¤·¤Þ¤¦¤³¤È¤Ç¡¢
266 ºÇ²¼°Ì¥¢¥É¥ì¥¹¤«¤é¾å°Ì¥¢¥É¥ì¥¹Êý¸þ¤ËÀѤޤì¤ë¥Ò¡¼¥×¤È¤Ö¤Ä¤«¤Ã¤Æ¤·¤Þ¤¦¾ì¹ç¤ä¡¢
267 \fBsetrlimit(RLIMIT_STACK, &rlim)\fP ¤Î¸Æ¤Ó½Ð¤·¤Ç³ÎΩ¤µ¤ì¤¿
268 À©¸Â¤Ë㤷¤Æ¤·¤Þ¤Ã¤¿¾ì¹ç¤Ë¡¢¤³¤ÎÍͤʻö¤¬µ¯¤³¤ë¡£
269 .\"O If the standard stack is exhausted, the kernel sends
270 .\"O the process a \fBSIGSEGV\fP signal.
271 .\"O In these circumstances the only way to catch this signal is
272 .\"O on an alternate signal stack.
273 ɸ½à¤Î¥¹¥¿¥Ã¥¯¤ò»È¤¤²Ì¤¿¤·¤Æ¤·¤Þ¤¦¤È¡¢
274 ¥«¡¼¥Í¥ë¤Ï¥×¥í¥»¥¹¤Ë \fBSIGSEGV\fP ¥·¥°¥Ê¥ë¤òÁ÷¤ë¡£
275 ¤³¤Î¤è¤¦¤Ê¾õ¶·¤Ç¤Ï¡¢ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¾å¤Ç¤·¤«¥·¥°¥Ê¥ë¤ò¥¥ã¥Ã¥Á¤Ç¤¤Ê¤¤¡£
277 .\"O On most hardware architectures supported by Linux, stacks grow
279 .\"O .BR sigaltstack ()
280 .\"O automatically takes account
281 .\"O of the direction of stack growth.
282 Linux ¤¬¥µ¥Ý¡¼¥È¤¹¤ë¿¤¯¤Î¥Ï¡¼¥É¥¦¥§¥¢¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ç¤Ï¡¢
283 ¥¹¥¿¥Ã¥¯¤Ï²¼°Ì¥¢¥É¥ì¥¹Êý¸þ¤ËÀѤޤì¤ë¡£
285 ¤Ï¥¹¥¿¥Ã¥¯¤¬ÀѤޤì¤ëÊý¸þ¤ò¼«Æ°Åª¤Ë·èÄꤹ¤ë¡£
287 .\"O Functions called from a signal handler executing on an alternate
288 .\"O signal stack will also use the alternate signal stack.
289 .\"O (This also applies to any handlers invoked for other signals while
290 .\"O the process is executing on the alternate signal stack.)
291 .\"O Unlike the standard stack, the system does not
292 .\"O automatically extend the alternate signal stack.
293 .\"O Exceeding the allocated size of the alternate signal stack will
294 .\"O lead to unpredictable results.
295 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¾å¤Ç¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë
296 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤«¤é¸Æ¤Ð¤ì¤ë´Ø¿ô¤â¡¢ÂåÂØ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ò»È¤¦
297 (¥×¥í¥»¥¹¤¬ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¾å¤Ç¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
298 ¾¤Î¥·¥°¥Ê¥ë¤Ç¸Æ¤Ó½Ð¤µ¤ì¤ë¥Ï¥ó¥É¥é¤â¤³¤ÎÂåÂØ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ò»È¤¦)¡£
299 ɸ½à¤Î¥¹¥¿¥Ã¥¯¤È¤Ï°Û¤Ê¤ê¡¢
300 ¥·¥¹¥Æ¥à¤ÏÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ò¼«Æ°Åª¤Ë³ÈÄ¥¤·¤Ê¤¤¡£
301 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯ÍѤ˳ÎÊݤ·¤¿¥µ¥¤¥º¤ò±Û¤¨¤¿¾ì¹ç¡¢
304 .\"O A successful call to
306 .\"O removes any existing alternate
308 .\"O A child process created via
310 .\"O inherits a copy of its parent's alternate signal stack settings.
312 ¤Î¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È¡¢
313 ´û¸¤ÎÁ´¤Æ¤ÎÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤¬ºï½ü¤µ¤ì¤ë¡£
315 ·Ðͳ¤ÇºîÀ®¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Ï¡¢¿Æ¥×¥í¥»¥¹¤ÎÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Î
316 ÀßÄê¤Î¥³¥Ô¡¼¤ò·Ñ¾µ¤¹¤ë¡£
318 .\"O .BR sigaltstack ()
319 .\"O supersedes the older
322 .\"O For backwards compatibility, glibc also provides
323 .\"O .BR sigstack ().
324 .\"O All new applications should be written using
325 .\"O .BR sigaltstack ().
329 ¤òÃÖ¤´¹¤¨¤ë¤â¤Î¤Ç¤¢¤ë¡£
330 ²áµî¥×¥í¥°¥é¥à¤È¤Î¸ß´¹À¤Î¤¿¤á¡¢glibc ¤Ç¤Ï
333 ¿·¤·¤¤¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÏÁ´¤Æ
335 ¤ò»È¤Ã¤Æ½ñ¤¯¤Ù¤¤Ç¤¢¤ë¡£
341 .\"O It used a slightly
342 .\"O different struct, and had the major disadvantage that the caller
343 .\"O had to know the direction of stack growth.
346 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬¤¢¤Ã¤¿¡£
347 ¤³¤Î´Ø¿ô¤Ï¾¯¤·°Û¤Ê¤Ã¤¿¹½Â¤ÂΤò»È¤Ã¤Æ¤ª¤ê¡¢
348 ¸Æ¤Ó½Ð¤·¤¿Â¦¤¬¥¹¥¿¥Ã¥¯¤ÎÀѤޤì¤ëÊý¸þ¤òÃΤäƤ¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤È¤¤¤¦
352 .\"O The following code segment demonstrates the use of
353 .\"O .BR sigaltstack ():
356 ¤Î»ÈÍÑË¡¤Î°ìÉô¤ò¼¨¤¹:
362 ss.ss_sp = malloc(SIGSTKSZ);
363 if (ss.ss_sp == NULL)
364 .\"O /* Handle error */;
365 /* ¥Ï¥ó¥É¥ë¥¨¥é¡¼ */;
366 ss.ss_size = SIGSTKSZ;
368 if (sigaltstack(&ss, NULL) == \-1)
369 .\"O /* Handle error */;
370 /* ¥Ï¥ó¥É¥ë¥¨¥é¡¼ */;