source: trunk/libs/newlib/src/newlib/libc/signal/signal.tex @ 471

Last change on this file since 471 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.3 KB
Line 
1@node Signals
2@chapter Signal Handling (@file{signal.h})
3
4A @dfn{signal} is an event that interrupts the normal flow of control
5in your program.  Your operating environment normally defines the full
6set of signals available (see @file{sys/signal.h}), as well as the
7default means of dealing with them---typically, either printing an
8error message and aborting your program, or ignoring the signal.
9
10All systems support at least the following signals:
11@table @code
12@item SIGABRT
13Abnormal termination of a program; raised by the @code{abort} function.
14
15@item SIGFPE
16A domain error in arithmetic, such as overflow, or division by zero.
17
18@item SIGILL
19Attempt to execute as a function data that is not executable.
20
21@item SIGINT
22Interrupt; an interactive attention signal.
23
24@item SIGSEGV
25An attempt to access a memory location that is not available.
26
27@item SIGTERM
28A request that your program end execution.
29@end table
30
31Two functions are available for dealing with asynchronous
32signals---one to allow your program to send signals to itself (this is
33called @dfn{raising} a signal), and one to specify subroutines (called
34@dfn{handlers} to handle particular signals that you anticipate may
35occur---whether raised by your own program or the operating environment.
36
37To support these functions, @file{signal.h} defines three macros:
38
39@table @code
40@item SIG_DFL
41Used with the @code{signal} function in place of a pointer to a
42handler subroutine, to select the operating environment's default
43handling of a signal.
44
45@item SIG_IGN
46Used with the @code{signal} function in place of a pointer to a
47handler, to ignore a particular signal.
48
49@item SIG_ERR
50Returned by the @code{signal} function in place of a pointer to a
51handler, to indicate that your request to set up a handler could not
52be honored for some reason.
53@end table
54
55@file{signal.h} also defines an integral type, @code{sig_atomic_t}.
56This type is not used in any function declarations; it exists only to
57allow your signal handlers to declare a static storage location where
58they may store a signal value.  (Static storage is not otherwise
59reliable from signal handlers.)
60
61@menu
62* psignal:: Print a signal message to standard error
63* raise::   Send a signal
64* signal::  Specify handler subroutine for a signal
65@end menu
66
67@page
68@include signal/psignal.def
69
70@page
71@include signal/raise.def
72
73@page
74@include signal/signal.def
Note: See TracBrowser for help on using the repository browser.