]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/signal.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / Include / signal.h
diff --git a/StdLib/Include/signal.h b/StdLib/Include/signal.h
new file mode 100644 (file)
index 0000000..52873c7
--- /dev/null
@@ -0,0 +1,83 @@
+/** @file\r
+  The header <signal.h> declares a type and two functions and defines several\r
+  macros, for handling various signals (conditions that may be reported during\r
+  program execution).\r
+\r
+  The UEFI implementation of <signal.h> maps signals onto the UEFI\r
+  event mechanism.\r
+\r
+  An implementation need not generate any of these signals, except as a result\r
+  of explicit calls to the raise function. Additional signals and pointers to\r
+  undeclarable functions, with macro definitions beginning, respectively, with\r
+  the letters SIG and an uppercase letter or with SIG_ and an uppercase letter\r
+  may also be specified by the implementation. The complete set of signals,\r
+  their semantics, and their default handling is implementation-defined; all\r
+  signal numbers shall be positive.\r
+\r
+Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+#ifndef _SIGNAL_H\r
+#define _SIGNAL_H\r
+#include  <sys/EfiCdefs.h>\r
+#include  <sys/signal.h>\r
+\r
+/*  The type sig_atomic_t is the (possibly volatile-qualified) integer type of\r
+    an object that can be accessed as an atomic entity, even in the presence\r
+    of asynchronous interrupts.\r
+\r
+    This, possibly machine specific, type is defined in <machine/signal.h>.\r
+*/\r
+\r
+/** The following three macros expand to constant expressions with distinct\r
+    values that have type compatible with the second argument to, and the\r
+    return value of, the signal function, and whose values compare unequal to\r
+    the address of any declarable function.\r
+**/\r
+#define SIG_IGN   ((__sighandler_t *) 0)\r
+#define SIG_DFL   ((__sighandler_t *) 1)\r
+#define SIG_ERR   ((__sighandler_t *) 3)\r
+\r
+/** The following members expand to positive integer constant expressions with\r
+    type int and distinct values that are the signal numbers, each\r
+    corresponding to the specified condition.\r
+    Many existing programs expect these to be macros.\r
+**/\r
+#define SIGINT    1   ///< receipt of an interactive attention signal\r
+#define SIGILL    2   ///< detection of an invalid function image, such as an invalid instruction\r
+#define SIGABRT   3   ///< abnormal termination, such as is initiated by the abort function\r
+#define SIGFPE    4   ///< an erroneous arithmetic operation, such as zero divide or an operation resulting in overflow\r
+#define SIGSEGV   5   ///< an invalid access to storage\r
+#define SIGTERM   6   ///< a termination request sent to the program\r
+#define SIG_LAST  7   ///< One more than the largest signal number\r
+\r
+__BEGIN_DECLS\r
+\r
+/*  For historical reasons; programs expect signal to be declared\r
+    in <sys/signal.h>.  The function is documented in <sys/signal.h>.\r
+\r
+    The function is declared in the C Standard as:<BR>\r
+      void (*signal(int sig, void (*func)(int)))(int);\r
+*/\r
+\r
+/** Send a signal.\r
+\r
+    The raise function carries out the actions described for signal,\r
+    in <sys/signal.h>, for the signal sig. If a signal handler is called, the\r
+    raise function shall not return until after the signal handler does.\r
+\r
+    @return   The raise function returns zero if successful,\r
+              nonzero if unsuccessful.\r
+**/\r
+int raise(int sig);\r
+\r
+__END_DECLS\r
+\r
+#endif  /* _SIGNAL_H */\r