Penguin
Annotated edit history of signal(2) version 2, including all changes. View license author blame.
Rev Author # Line
1 perry 1 SIGNAL
2 !!!SIGNAL
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 PORTABILITY
8 NOTES
9 CONFORMING TO
10 SEE ALSO
11 ----
12 !!NAME
13
14
15 signal - ANSI C signal handling
16 !!SYNOPSIS
17
18
19 __#include __
20
21
22 __typedef void (*sighandler_t)(int);__
23
24
25 __sighandler_t signal(int__ ''signum''__,
26 sighandler_t__ ''handler''__);__
27 !!DESCRIPTION
28
29
30 The __signal__() system call installs a new signal
31 handler for the signal with number ''signum.'' The signal
32 handler is set to ''sighandler'' which may be a user
33 specified function, or either __SIG_IGN__ or
34 __SIG_DFL__.
35
36
37 Upon arrival of a signal with number ''signum'' the
38 following happens. If the corresponding handler is set to
39 __SIG_IGN__, then the signal is ignored. If the handler
40 is set to __SIG_DFL__, then the default action associated
41 to the signal (see signal(7)) occurs. Finally, if the
42 handler is set to a function ''sighandler'' then the
43 signal is blocked and ''sighandler'' is called with
44 argument ''signum''. The signal remains blocked during
45 the execution of the signal handler.
46
47
48 Using a signal handler function for a signal is called
49 SIGKILL__
50 and __SIGSTOP__ cannot be caught or ignored.
51 !!RETURN VALUE
52
53
54 The __signal__() function returns the previous value of
55 the signal handler, or __SIG_ERR__ on error.
56 !!PORTABILITY
57
58
59 The original Unix __signal__() would reset the handler to
60 SIG_DFL, and System V (and the Linux kernel and libc4,5)
61 does the same. On the other hand, BSD does not reset the
62 handler, but blocks new instances of this signal from
63 occurring during a call of the handler. The glibc2 library
64 follows the BSD behaviour.
65
66
67 In a libc5 system including ____
68 instead of ____ makes __signal__ to be
69 redefined as ____bsd_signal__ and signal has the BSD
70 semantics. This is not recommended.
71
72
73 In a glibc2 system defining a feature test macro such as
74 ___XOPEN_SOURCE__ or using a separate __sysv_signal__
75 function, the classical behaviour is obtained. This is not
76 recommended.
77
78
79 Trying to change the semantics of this call using defines
80 and includes is not a good idea. It is better to avoid
81 __signal__ altogether, and use sigaction(2)
82 instead.
83 !!NOTES
84
85
86 According to POSIX, the behaviour of a process is undefined
87 after it ignores a __SIGFPE__, __SIGILL__, or
88 __SIGSEGV__ signal that was not generated by the
89 kill(2) or the raise(3) functions. Integer
90 division by zero has undefined result. On some architectures
91 it will generate a __SIGFPE__ signal. (Also dividing the
92 most negative integer by -1 may generate __SIGFPE__.)
93 Ignoring this signal might lead to an endless
94 loop.
95
96
97 According to POSIX (3.3.1.3) it is unspecified what happens
98 when __SIGCHLD__ is set to __SIG_IGN__. Here the BSD
99 and SYSV behaviours differ, causing BSD software that sets
100 the action for __SIGCHLD__ to __SIG_IGN__ to fail on
101 Linux.
102
103
104 The use of the __sighandler_t__ is a GNU extension.
105 Various versions of libc predefine this type; libc4 and
2 perry 106 libc5 define ''!SignalHandler'', glibc defines
1 perry 107 ''sig_t'' and, when ___GNU_SOURCE__ is defined, also
108 ''sighandler_t''.
109 !!CONFORMING TO
110
111
112 ANSI C
113 !!SEE ALSO
114
115
116 kill(1), kill(2), killpg(2),
117 pause(2), raise(3), sigaction(2),
118 signal(7), sigsetops(3), sigvec(2),
119 alarm(2)
120 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.