]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/signal.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / Include / signal.h
1 /** @file
2 The header <signal.h> declares a type and two functions and defines several
3 macros, for handling various signals (conditions that may be reported during
4 program execution).
5
6 The UEFI implementation of <signal.h> maps signals onto the UEFI
7 event mechanism.
8
9 An implementation need not generate any of these signals, except as a result
10 of explicit calls to the raise function. Additional signals and pointers to
11 undeclarable functions, with macro definitions beginning, respectively, with
12 the letters SIG and an uppercase letter or with SIG_ and an uppercase letter
13 may also be specified by the implementation. The complete set of signals,
14 their semantics, and their default handling is implementation-defined; all
15 signal numbers shall be positive.
16
17 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
18 This program and the accompanying materials are licensed and made available under
19 the terms and conditions of the BSD License that accompanies this distribution.
20 The full text of the license may be found at
21 http://opensource.org/licenses/bsd-license.php.
22
23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
24 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25
26 **/
27 #ifndef _SIGNAL_H
28 #define _SIGNAL_H
29 #include <sys/EfiCdefs.h>
30 #include <sys/signal.h>
31
32 /* The type sig_atomic_t is the (possibly volatile-qualified) integer type of
33 an object that can be accessed as an atomic entity, even in the presence
34 of asynchronous interrupts.
35
36 This, possibly machine specific, type is defined in <machine/signal.h>.
37 */
38
39 /** The following three macros expand to constant expressions with distinct
40 values that have type compatible with the second argument to, and the
41 return value of, the signal function, and whose values compare unequal to
42 the address of any declarable function.
43 **/
44 #define SIG_IGN ((__sighandler_t *) 0)
45 #define SIG_DFL ((__sighandler_t *) 1)
46 #define SIG_ERR ((__sighandler_t *) 3)
47
48 /** The following members expand to positive integer constant expressions with
49 type int and distinct values that are the signal numbers, each
50 corresponding to the specified condition.
51 Many existing programs expect these to be macros.
52 **/
53 #define SIGINT 1 ///< receipt of an interactive attention signal
54 #define SIGILL 2 ///< detection of an invalid function image, such as an invalid instruction
55 #define SIGABRT 3 ///< abnormal termination, such as is initiated by the abort function
56 #define SIGFPE 4 ///< an erroneous arithmetic operation, such as zero divide or an operation resulting in overflow
57 #define SIGSEGV 5 ///< an invalid access to storage
58 #define SIGTERM 6 ///< a termination request sent to the program
59 #define SIG_LAST 7 ///< One more than the largest signal number
60
61 __BEGIN_DECLS
62
63 /* For historical reasons; programs expect signal to be declared
64 in <sys/signal.h>. The function is documented in <sys/signal.h>.
65
66 The function is declared in the C Standard as:<BR>
67 void (*signal(int sig, void (*func)(int)))(int);
68 */
69
70 /** Send a signal.
71
72 The raise function carries out the actions described for signal,
73 in <sys/signal.h>, for the signal sig. If a signal handler is called, the
74 raise function shall not return until after the signal handler does.
75
76 @return The raise function returns zero if successful,
77 nonzero if unsuccessful.
78 **/
79 int raise(int sig);
80
81 __END_DECLS
82
83 #endif /* _SIGNAL_H */