File: sigaltstack.2

package info (click to toggle)
manpages-ja 0.4.0.0.20020315-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 14,808 kB
  • ctags: 4
  • sloc: sh: 9,595; perl: 157; makefile: 62
file content (193 lines) | stat: -rw-r--r-- 6,331 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
'\" t
.\" Copyright (c) 2001, Michael Kerrisk (mtk16@ext.canterbury.ac.nz)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" aeb, various minor fixes
.\"
.\" Japanese Version Copyright (c) 2001 Yuichi SATO
.\"         all rights reserved.
.\" Translated Sun Nov  4 23:00:01 JST 2001
.\"         by Yuichi SATO <ysato@h4.dion.ne.jp>
.\" Updated Sun Dec  9 15:39:45 JST 2001 by Yuichi SATO
.\"
.\"WORD:	establish	(å) Ω
.\"
.TH SIGALTSTACK 2 2001-09-27 "Linux 2.4" "Linux Programmer's Manual"
.SH ̾
sigaltstack - ʥ륹åΥƥȤꡦ
.SH 
.B #include <signal.h>
.sp
.BI "int sigaltstack(const stack_t *" ss ", stack_t *" oss );
.SH 
\fBsigaltstack\fP Ȥȡ
ץϿإʥ륹åꡢ
¸إʥ륹åξ֤Ǥ롣
ʥϥɥ餬إʥ륹å׵᤹褦ꤵƤȡ
ϥɥμ¹
.RB ( sigaction (2)
򻲾) ϤΥʥ륹åȤ롣

إʥ륹åȤݤΰŪʼϡʲ̤Ǥ:
.TP
1.
إʥ륹åǻȤΰݤ롣
.TP
2.
\fBsigaltstack\fP Ȥäơ
إʥ륹å¸ߤȾ򥷥ƥΤ餻롣
.TP
3.
\fBsigaction\fP ȤäƥʥϥɥΩݡ
\fBSA_ONSTACK\fP ե饰ꤹ뤳Ȥˤꡢ
Υʥϥɥإʥ륹åǼ¹Ԥ뤳Ȥ
ƥΤ餻롣
.P
\fIss\fP ϡʥ륹åꤹ뤿˻Ȥ
ޤ \fIoss\fP ϡ߳ΩƤ
ʥ륹åξ뤿˻Ȥ
Τ 1 Ĥ¹Ԥˤϡ
Ѥʤ NULL ˻ꤹФ褤
Ȥʤ빽¤ΤϡʲΤ褦ʷǤ:
.sp
.RS
.nf
typedef struct {
    void  *ss_sp;     /* åΥ١ɥ쥹 */
    int    ss_flags;  /* ե饰 */
    size_t ss_size;   /* åΥХȿ */
} stack_t;
.fi
.RE

إʥ륹åΩˤϡ
\fIss.ss_flags\fP  0 ꤷ
\fIss.sp_sp\fP  \fIss.ss_size\fP 
åγϥɥ쥹ȥåꤹ롣
 \fBSIGSTKSZ\fP ϡإʥ륹å̾ɬפ
⽼ʬ礭Ƥ롣
ޤ \fBMINSIGSTKSZ\fP ϡ
ʥϥɥμ¹ԤɬפʺǾƤ롣

¸Υå̵ˤˤϡ
\fIss.ss_flags\fP  \fBSS_DISABLE\fP ˻ꤹ롣
ξ硢\fIss\fP ¾Υեɤ̵뤵롣

\fIoss\fP  NULL ˤȡإʥ륹åξ֤롣
 \fBsigaltstack\fP θƤӽФ˹Ԥ롣
\fIoss.ss_sp\fP  \fIoss.ss_size\fP եɤ
åγϥɥ쥹ȥå֤롣
\fIoss.ss_flags\fP ˤϰʲΤɤ餫֤ͤ:

.TP
.B SS_ONSTACK
ץإʥ륹åǼ¹ԤƤ롣
(ץˤΥʥ륹åǼ¹ԤƤϡ
Ʊʥ륹åˤѹǤʤդ뤳ȡ)
.TP
.B SS_DISABLE
إʥ륹å̵ˤƤ롣

.SH ֤
\fBsigaltstack\fP  0 ֤
Ԥ \-1 ֤ơ
顼򼨤ͤ \fIerrno\fP ꤹ롣

.SH 顼
.TP
.B ENOMEM
إʥ륹åΥ (\fIss.ss_size\fP) 
\fBMINSTKSZ\fP 꾮
.TP
.B EFAULT
\fIss\fP ޤ \fIoss\fP Τɤ餬NULL Ǥʤ
ĥץΥɥ쥹֤γؤƤ롣
.TP
.B EPERM
إʥ륹åͭǤȤѹԤȤ
(Ĥޤꡢץ˸ߤإʥ륹åǼ¹ԤƤ)
.TP
.B EINVAL
\fIss\fP  NULL Ǥʤ\fPss_flags\fP եɤ
SS_DISABLE ʳ 0 ǤʤͤˤʤäƤ롣

.SH 
ʲΥɤ \fBsigaltstack\fP λˡΰ򼨤:

.RS
.nf
stack_t ss;

ss.ss_sp = malloc(SIGSTKSZ);
if (ss.ss_sp == NULL)
    /* ϥɥ륨顼 */;
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) == -1)
    /* ϥɥ륨顼 */;
.fi
.RE
.P
ץɸΥʥ륹åȤ̤Ȥͽۤϡ
إʥ륹åΩǤ롣
㤨СåǾ̥ɥ쥹
̥ɥ쥹ˤѤޤƤޤȤǡ
Dz̥ɥ쥹̥ɥ쥹ѤޤҡפȤ֤ĤäƤޤ䡢
\fBsetrlimit(RLIMIT_STACK, &rlim)\fP θƤӽФdzΩ줿
¤ãƤޤäˡͤʻ롣
ɸΥåȤ̤Ƥޤä硢
ͥ뤬ץ \fBSIGSEGV\fP ʥ롣
Τ褦ʾǤϡإʥ륹åǤʥ򥭥åǤʤ
.P
Linux ǥݡȤ¿ΥϡɥƥǤϡ
åϲ̥ɥ쥹Ѥޤ롣
\fBsigaltstack\fP ϥåѤޤưŪ˷ꤹ롣
.P
إʥ륹åǼ¹ԤƤ
ʥϥɥ餫ƤФؿ⡢إʥϥɥȤ
(ץإʥ륹åǼ¹ԤƤ硢
¾ΥʥǸƤӽФϥɥ⤳إʥϥɥȤ)
ɸΥåȤϰۤʤꡢ
ƥإʥ륹åưŪ˳ĥʤ
إʥ륹åѤ˳ݤۤ硢
̤ͽۤǤʤ
.P
\fBexecve\fP θƤӽФȡ
¸Ƥإʥ륹å롣
.P
\fBsigaltstack\fP ϰ \fBsigstack\fP ֤ΤǤ롣
ץȤθߴΤᡢglibc Ǥ \fBsigstack\fP 󶡤Ƥ롣
ƤΥץꥱ \fBsigaltstack\fR Ȥäƽ񤯤٤Ǥ롣

.SH 
BSD 4.2 ˤ \fIsigstack\fP() ƥॳ뤬ä
δؿϾۤʤä¤ΤȤäƤꡢ
ƤӽФ¦åѤޤΤäƤʤФʤʤȤ
礭ʷä

.SH 
SUSv2, SVr4, POSIX 1003.1-2001.

.SH Ϣ
.BR sigaction (2),
.BR setrlimit (2),
.BR execve (2),
.BR sigsetjmp (3),
.BR siglongjmp (3),
.BR signal (7)