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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
.\" Copyright (c) 2000 Andries Brouwer <aeb@cwi.nl>
.\" and Copyright (c) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
.\" based on work by Rik Faith <faith@cs.unc.edu>
.\" and Mike Battersby <mike@starbug.apana.org.au>.
.\"
.\" 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. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified 2004-11-19, mtk:
.\" added pointer to sigaction.2 for details of ignoring SIGCHLD
.\" 2007-06-03, mtk: strengthened portability warning, and rerote
.\" various sections.
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated 1997-03-03, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified 2000-09-24, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated & Modified 2002-01-14, Yuichi SATO <ysato@h4.dion.ne.jp>
.\" Updated & Modified 2004-01-17, Yuichi SATO <ysato444@yahoo.co.jp>
.\" Updated & Modified 2005-01-07, Yuichi SATO
.\" Updated 2007-06-01, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.50
.\" Updated 2007-06-13, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.55
.\"
.\"WORD: signal ʥ
.\"WORD: signal handler ʥ롦ϥɥ
.\"WORD: library 饤֥
.\"WORD: semantics
.\"WORD: prototype
.\"WORD: architecture ƥ㡼
.\"WORD: endless loop ̵¥롼
.\"WORD: feature test macro ǽޥ
.\"
.TH SIGNAL 2 2007-06-03 "Linux" "Linux Programmer's Manual"
.SH ̾
signal \- ANSI C ʥ
.SH
.B #include <signal.h>
.sp
.B typedef void (*sighandler_t)(int);
.sp
.BI "sighandler_t signal(int " signum ", sighandler_t " sighandler );
.SH
.BR signal ()
ư Unix ΥСˤۤʤ롣
ޤŪ˸ Linux ΥСˤäƤۤʤäƤ롣
\fBΥƥॳλѤ\fP
.BR sigaction (2)
Ѥ뤳ȡ
Ρְܿפȡ
.BR signal ()
ϥʥ
.I signum
νˡ
.I handler
ꤹ롣
.I handler
ˤϡ
.BR SIG_IGN ""
.BR SIG_DFL ""
ץޤؿ (֥ʥ롦ϥɥ) Υɥ쥹
줫ꤹ롣
ʥ
.I signum
ץȡʲΤ줫ȯ롣
.TP 3
*
ˡ
.B SIG_IGN
ꤵƤ硢Υʥ̵뤵롣
.TP
*
ˡ
.B SIG_DFL
ꤵƤ硢ʥ˴ϢŤ줿
ǥեȤưԤ
.RB ( signal (7)
)
.TP
*
ˡȤƴؿꤵƤ硢
ޤǽ˽ˡ
.B SIG_DFL
˥ꥻåȤ뤫ΥʥΥ֥å¹Ԥ줿塢
.I signum
Ȥ
.I handler
ƤӽФ롣
ϥɥ餬ưݤ˥ʥ뤬֥å줿硢
ϥɥ餬֤ݤˤΥʥΥ֥å롣
.PP
ʥ
.B SIGKILL
.B SIGSTOP
ªǤ̵뤹뤳ȤǤʤ
.SH ֤
.BR signal ()
ϡޤǤΥʥ롦ϥɥ֤ͤ顼ξ
.B SIG_ERR
֤
.SH 顼
.TP
.B EINVAL
.I signum
Ǥ롣
.SH
C89, C99, POSIX.1-2001.
.SH
ޥåɥץˤ
.BR signal ()
η̤ϡꤵƤʤ
.PP
POSIX ˤȡ
.BR kill (2)
.BR raise (3)
Ǥʤ
.BR SIGFPE ,
.BR SIGILL ,
.B SIGSEGV
ʥ̵뤷ư̤Ǥ롣
0 ˤ껻η̤̤Ȥʤ롣
ΥƥǤϡ
.B SIGFPE
ʥ롣
(Ʊͤκ \-1 dz
.B SIGFPE
뤫⤷ʤ)
Υʥ̵뤹̵¥롼פ˴٤뤫⤷ʤ
.PP
.B SIGCHLD
ưȤ
.B SIG_IGN
ꤷξܺ٤ưˤĤƤϡ
.BR sigaction (2)
Ȥ뤳ȡ
.PP
ʥ롦ϥɥ⤫˸ƤӽФȤǤ롢
async-signal-safe functions (Ʊǰʴؿ)
ꥹȤˤĤƤ
.BR signal (7)
ȡ
.PP
.I sighandler_t
λѤ GNU ĥǤ롣
ƼС libc ǤηѤߤǤ;
libc4 libc5 Ǥ
.I SignalHandler
Ƥ롣
glibc Ǥ
.I sig_t
Ƥꡢ
.B _GNU_SOURCE
Ƥˤ
.I sighandler_t
Ƥ롣
.SS ܿ
Unix Υꥸʥ
.BR signal ()
ϥϥɥ
.B SIG_DFL
˥ꥻåȤ롣
System V ( Linux ͥ libc4,5) ƱǤ롣
BSD ǤϥϥɥΥꥻåȤԤ鷺
ϥɥ餬ƤФƤ֤
ʥοȯΤ֥å롣
glibc2 饤֥Ǥ BSD ư˽äƤ롣
libc5 ƥˤ
.I <signal.h>
Τ
.I <bsd/signal.h>
롼ɤȡ
.BR signal ()
.BR __bsd_signal ()
˺졢
.BR signal ()
BSD Ȥʤ롣
Ͽ侩ʤ
glibc2 ƥˤ
.B _XOPEN_SOURCE
Τ褦ʵǽޥꡢδؿȤ̤
.BR sysv_signal (3)
ؿȤäꤹСΤ褦ư롣
Ͽ侩ʤ
.SH Ϣ
.BR kill (1),
.BR alarm (2),
.BR kill (2),
.BR killpg (2),
.BR pause (2),
.BR sigaction (2),
.BR signalfd (2),
.BR sigpending (2),
.BR sigprocmask (2),
.BR sigqueue (2),
.BR sigsuspend (2),
.BR bsd_signal (3),
.BR raise (3),
.BR siginterrupt (3),
.BR sigsetops (3),
.BR sigvec (3),
.BR sysv_signal (3),
.BR feature_test_macros (7),
.BR signal (7)
|