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 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
|
'\" t
.\" Copyright (c) 1994,1995 Mike Battersby <mib@deakin.edu.au>
.\" and Copyright 2004, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
.\" based on work by faith@cs.unc.edu
.\"
.\" 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, aeb, 960424
.\" Modified Fri Jan 31 17:31:20 1997 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Thu Nov 26 02:12:45 1998 by aeb - add SIGCHLD stuff.
.\" Modified Sat May 8 17:40:19 1999 by Matthew Wilcox
.\" add POSIX.1b signals
.\" Modified Sat Dec 29 01:44:52 2001 by Evan Jones <ejones@uwaterloo.ca>
.\" SA_ONSTACK
.\" Modified 2004-11-11 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Added mention of SIGCONT under SA_NOCLDSTOP
.\" Added SA_NOCLDWAIT
.\" Modified 2004-11-17 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Updated discussion for POSIX.1-2001 and SIGCHLD and sa_flags.
.\" Formatting fixes
.\" 2004-12-09, mtk, added SI_TKILL + other minor changes
.\" 2005-09-15, mtk, split sigpending(), sigprocmask(), sigsuspend()
.\" out of this page into separate pages.
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya all rights reserved.
.\" Translated 1997-03-03, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified 2000-10-02, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified 2001-10-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2005-03-15, Akihiro MOTOKI
.\" Updated 2005-10-05, Akihiro MOTOKI
.\" Updated 2007-09-08, Akihiro MOTOKI, LDP v2.64
.\"
.\"WORD: signal ʥ
.\"WORD: process ץ
.\"WORD: signal handler ʥϥɥ
.\"WORD: pointer ݥ
.\"WORD: mask ޥ
.\"WORD: block ػ(block)
.\"WORD: suspend (suspend)
.\"WORD: stop (stop)
.\"WORD: catch (catch)
.\"WORD: architecture ƥ㡼
.\"WORD: compatible ߴ
.\"WORD: pottable ܿ
.\"
.TH SIGACTION 2 2007-07-08 "Linux" "Linux Programmer's Manual"
.SH ̾
sigaction \- ʥưγǧѹ
.SH
.nf
.B #include <signal.h>
.sp
.BI "int sigaction(int " signum ", const struct sigaction *" act ,
.BI " struct sigaction *" oldact );
.fi
.SH
.BR sigaction ()
ƥॳϡΥʥݤ
ץưѹΤ˻Ѥ롣
.PP
.I signum
ˤϡ
.B SIGKILL
.B SIGSTOP
ʳͭʥʥɤǤǤ롣
.PP
.I act
NULL ʳǤСʥ
.I signum
οư (action) Ȥ
.I act
ꤵ롣
.I oldact
NULL ǤʤСޤǤư
.I oldact
˳Ǽ롣
.PP
.I sigaction
¤ΤϰʲΤ褦ʴ롣
.sp
.in +4n
.nf
struct sigaction {
void (*sa_handler)(int);
void (*sa_sigaction)(int, siginfo_t *, void *);
sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)(void);
};
.fi
.in
.PP
ƥˤäƤ϶ (union) ѤƤꡢξˤ
.I sa_handler
.I sa_sigaction
ξƱ˳Ƥ뤳ȤϤǤʤ
.PP
.I sa_restorer
ǤѻͽǤѤ٤ǤϤʤ
POSIX ˤ
.I sa_restorer
Ǥ˴ؤ뵬Ϥʤ
.PP
.I sa_handler
.I signum
бưꤹΤǡ
ǥեȤưԤ
.BR SIG_DFL
Υʥ̵뤹
.BR SIG_IGN
ʥϥɥؿؤΥݥǤ롣
ʥϥɥؿΰϰĤǤꡢʥֹ椬Ȥ
Ϥ롣
.PP
.I sa_flags
.B SA_SIGINFO
ꤵ줿硢
.RI ( sa_handler
ǤϤʤ)
.I sa_sigaction
ˤ
.I signum
б륷ʥϥɥؿꤵ롣
ꤵؿϡǽΰȤƥʥֹ
ܤΰȤ
.I siginfo_t
ؤΥݥܤΰȤ (void * ˥㥹Ȥ)
.I ucontext_t
ؤΥݥȤ롣
.PP
.I sa_mask
ϡʥ롦ϥɥ¹˶ػ (block) 륷ʥΥޥɽ
ˡ
.B SA_NODEFER
ե饰ꤵƤʤϡϥɥư뤭äȤʤ
ʥˤ
.I sa_mask
ŬѤ롣
.PP
.I sa_flags
ϥʥ롦ϥɥưѹ뤿Υե饰νꤹ롣
.I sa_flags
ˤϡʲ˼ե饰 (0 İʾ) ¤ȤäΤꤹ롣
.RS 4
.TP
.B SA_NOCLDSTOP
.I signum
.B SIGCHLD
ξ硢
ҥץߤ
(ҥץ
.BR SIGSTOP ", " SIGTSTP ", " SIGTTIN ", " SIGTTOU
Ȥ) Ƴ (ҥץ
.B SIGCONT
Ȥ) Ȥ
.B SIGCHLD
Τʤ
.TP
.B SA_NOCLDWAIT
(Linux 2.6 ʹ)
.\" Τˤ Linux 2.5.60 ʹ -- MTK
.I signum
.B SIGCHLD
ξ硢ҥץλȤ
ҥץӥץѲʤ
.RB ( waitpid (2)
⻲)
.TP
.B SA_RESETHAND
ʥϥɥ餬ƤФ٤ˡʥưǥեȤ᤹
.B SA_ONESHOT
ϤΥե饰Ʊ̣ѻߤƤꡢɸǤ롣
.TP
.B SA_ONSTACK
.BR sigaltstack (2)
̤Υʥ롦åǥʥϥɥƤӽФ
̤Υʥ롦åѲǽǤʤСǥեȤΥå
Ѥ롣
.TP
.B SA_RESTART
ĤΥƥॳʥΤǺƳǤ褦ˤơ
BSD ʥ (semantics) ȸߴΤư롣
.TP
.B SA_NODEFER
켫ȤΥʥ롦ϥɥ顼ˤǤ
Υʥޥʤ褦ˤ롣
.B SA_NOMASK
ϤΥե饰Ʊ̣ѻߤƤꡢɸǤ롣
.TP
.B SA_SIGINFO
ʥϥɥϰĤǤϤʤĤΰġξ
.I sa_handler
Τ
.I sa_sigaction
ꤷʤФʤʤ
.RI ( sa_sigaction
եɤ Linux 2.1.86 ɲä줿)
.RE
.PP
.I sa_sigaction
Υѥ
.I siginfo_t
ϰʲǤŤΤǤ:
.sp
.in +4n
.nf
siginfo_t {
.\" FIXME si_tid and si_overrun are not documented.
.\" FIXME si_trapno is not documented; is it actually used?
int si_signo; /* Signal number */
int si_errno; /* An errno value */
int si_code; /* Signal code */
pid_t si_pid; /* Sending process ID */
uid_t si_uid; /* Real user ID of sending process */
int si_status; /* Exit value or signal */
clock_t si_utime; /* User time consumed */
clock_t si_stime; /* System time consumed */
sigval_t si_value; /* Signal value */
int si_int; /* POSIX.1b signal */
void *si_ptr; /* POSIX.1b signal */
void *si_addr; /* Memory location which caused fault */
int si_band; /* Band event */
int si_fd; /* File descriptor */
}
.fi
.in
.IR si_signo ", " si_errno ", " si_code
ƤΥʥФƤ
.RI ( si_errno
Linux ǤϻѤʤ)
¤ΤλĤʬϡ (union) ˤʤäƤ뤫⤷ʤ
ξϳ륷ʥˤựΤեɤΤߤɤ߹
ȤǤ롣
.IP * 2
POSIX.1b ʥ
.B SIGCHLD
.IR si_pid " " si_uid
ꤹ롣
.BR
.IP *
.B SIGCHLD
Ϥ
.IR si_status ", " si_utime ", " si_stime
ꤹ롣
.IP *
.IR si_int " " si_ptr
POSIX.1b ʥԤˤäƻꤵ롣
ܺ٤
.BR sigqueue (2)
ȤΤȡ
.IP *
.BR SIGILL ,
.BR SIGFPE ,
.BR SIGSEGV ,
.B SIGBUS
.I si_addr
˥顼ȯɥ쥹ꤹ롣
SIGPOLL
.IR si_band " " si_fd
ꤹ롣
.PP
.I si_code
ϡΥʥ뤬줿ͳͤǤ (ӥåȥޥǤϤʤ)
ʲΥꥹȤˡɤΥʥξǤ
.I si_code
ꤦͤʥ뤬줿ͳȤȤ˵ܤ롣
.RS 4
.TP 15
.B SI_USER
.BR kill (2)
ޤ
.BR raise (3)
.TP
.B SI_KERNEL
ͥˤ줿
.TP
.B SI_QUEUE
.BR sigqueue (2)
.TP
.B SI_TIMER
POSIX ޤλ
.TP
.B SI_MESGQ
POSIX å塼ξ֤Ѳ (Linux 2.6.6 ʹ)
.BR mq_notify (3) ȡ
.TP
.B SI_ASYNCIO
Ʊ IO (AIO) λ
.TP
.B SI_SIGIO
塼줿 SIGIO
.TP
.B SI_TKILL
.BR tkill (2)
ޤ
.BR tgkill (2)
(Linux 2.4.19 ʹ)
.\" SI_DETHREAD is defined in 2.6.9 sources, but isn't implemented
.\" It appears to have been an idea that was tried during 2.5.6
.\" through to 2.5.24 and then was backed out.
.RE
.PP
.B SIGILL
ʥξ硢
.I si_code
ˤϰʲͤǤ:
.RS 4
.TP 15
.B ILL_ILLOPC
̿ᥳ (opcode)
.TP
.B ILL_ILLOPN
ʥڥ
.TP
.B ILL_ILLADR
ʥɥå⡼
.TP
.B ILL_ILLTRP
ʥȥå
.TP
.B ILL_PRVOPC
øɬפ̿ᥳ (opcode)
.TP
.B ILL_PRVREG
øɬפʥ쥸
.TP
.B ILL_COPROC
ץåΥ顼
.TP
.B ILL_BADSTK
å顼
.RE
.PP
.B SIGFPE
ʥξ硢
.I si_code
ˤϰʲͤǤ:
.RS 4
.TP 15
.B FPE_INTDIV
0 ˤ
.TP
.B FPE_INTOVF
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R sigaction ()
0 ֤顼ʤ \-1 ֤
.SH 顼
.TP
.B EFAULT
.IR act " " oldact
ؤƤ꤬ץΥɥ쥹֤ˤʤ
.TP
.B EINVAL
̵ʥʥ뤬ꤵ줿 (catch) ̵뤷Ǥʤ
ʥǤ
.BR SIGKILL " " SIGSTOP
Фưѹ褦Ȥˤȯ롣
.SH
POSIX.1-2001, SVr4.
.\" SVr4 ˤ EINTR ˤĤƤεҤϤʤ
.SH
.PP
POSIX Ǥϡ
.BR kill (2)
.BR raise (3)
ؿǤʤʥ
.BR SIGFPE ,
.BR SIGILL ,
.B SIGSEGV
̵ (ignore) 硢θư̤Ǥ롣
ˤ껻η̤̤Ȥʤ롣
ƥ㡼ˤäƤϡΤȤ
.B SIGFPE
ʥ뤬롣
(Ʊͤκ \-1 dz
.B SIGFPE
뤫⤷ʤ)
Υʥ̵뤹̵¥롼פ˴٤뤫⤷ʤ
.PP
POSIX.1-1990 Ǥ
.B SIGCHLD
.B SIG_IGN
ꤹ뤳ȤǧƤʤ
POSIX.1-2001 ǤǧƤꡢ
.B SIGCHLD
̵뤹뤳Ȥǥӥץɻߤ뤳ȤǤ
.RB ( wait (2)
)
ˡBSD SystemV Ǥ
.B SIGCHLD
̵뤷ݤưۤʤäƤ롣
Τᡢ˰ܿˡǡλҥץӤˤʤʤ
ݾڤˤϡ
.B SIGCHLD
ʥ
.BR wait (2)
ʤɤ¹Ԥ뤷ʤ
.PP
POSIX.1-1990 λͤǤ
.B SA_NOCLDSTOP
ΤߤƤ롣
POSIX.1-2001 Ǥ
.BR SA_NOCLDWAIT ,
.BR SA_RESETHAND ,
.BR SA_NODEFER ,
.B SA_SIGINFO
ɲä줿
Unix θŤưץꥱǡ
¾
.I sa_flags
ե饰ѤȰܿ롣
.PP
.B SA_SIGINFO
ե饰 Linux 2.2 饵ݡȤ褦ˤʤä
.PP
.B SA_RESETHAND
ե饰 SVr4 Ʊ̾Υե饰ȸߴ롣
.PP
.B SA_NODEFER
ե饰 1.3.9 ʹߤΥͥǤƱ̾ SVr4 Υե饰ȸߴ롣
Linux ͥμǤϡΥե饰ꤷƤ륷ʥ
ǤʤɤΥʥǤ뤳ȤƤ (ºݤˤ
.I sa_mask
ˤ̵ˤǤ)
.\".PP
.\"SVr4 ȸߴ
.\".BR SA_RESETHAND " " SA_NODEFER
.\"Ȥ̾ϡ饤֥ΥС 3.0.9 ʹߤ¸ߤ롣
.PP
.BR sigaction ()
ܤΰ NULL ꤷƸƤӽФȡߤΥʥϥɥǧ
ȤǤ롣ޤܤȻܤΰ NULL ˤƸƤӽФȤǡ
ꤵ줿ʥ뤬ߤΥޥǻȤ뤫ɤåǤ롣
.PP
.B SIGKILL
.B SIGSTOP
.RI ( sa_mask
˻ꤷ) ػߤ뤳ȤϤǤʤ
ػߤ褦ȤƤۤä̵뤵롣
.PP
ʥ뽸˴ؤܺ٤
.BR sigsetops (3)
Ȥ뤳ȡ
.PP
ʥϥɥ⤫˸ƤӽФȤǤ롢
async-signal-safe functions (Ʊǰʴؿ)
ꥹȤˤĤƤ
.BR signal (7)
ȡ
.SS
.B SA_SIGINFO
Ƴϡ
.I "struct sigcontext"
ܤΰȰ
.I sa_handler
Ѥ뤳Ȥǡ
Ĥɲäξꤹ뤳ȤǤ
ܺ٤ˤĤƤϥͥ륽δϢʬƤۤ
ߤϤλˡѻߤƤ롣
.SH Х
2.6.13 ΥͥǤϡ
.I sa_flags
.B SA_NODEFER
ꤷ硢
ϥɥ餬¹줿ʥ뼫ȤޥʤʤǤʤ
.I sa_mask
˻ꤵ줿ʥޥʤʤ롣
ΥХϡͥ 2.6.14 ǽ줿
.SH
.BR mprotect (2)
ȡ
.SH Ϣ
.BR kill (1),
.BR kill (2),
.BR killpg (2),
.BR pause (2),
.BR sigaltstack (2),
.BR signal (2),
.BR signalfd (2),
.BR sigpending (2),
.BR sigprocmask (2),
.BR sigqueue (2),
.BR sigsuspend (2),
.BR wait (2),
.BR raise (3),
.BR siginterrupt (3),
.BR sigsetops (3),
.BR sigvec (3),
.BR core (5),
.BR signal (7)
|