Home | History | Annotate | Download | only in Include
      1 /** @file
      2   This file 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     For historical reasons; programs expect signal to be declared
      7     in <sys/signal.h>.  The signal function is documented in <sys/signal.h>.
      8 
      9     The signal function is declared in the C Standard as:<BR>
     10     void (*signal(int sig, void (*func)(int)))(int);
     11 
     12     The EDK II implementation of the library or base firmware does not generate
     13     any of these signals, except as a result of explicit calls to the raise function.
     14 
     15     Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
     16     This program and the accompanying materials are licensed and made available under
     17     the terms and conditions of the BSD License that accompanies this distribution.
     18     The full text of the license may be found at
     19     http://opensource.org/licenses/bsd-license.
     20 
     21     THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     22     WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     23 **/
     24 #ifndef _SIGNAL_H
     25 #define _SIGNAL_H
     26 #include  <sys/EfiCdefs.h>
     27 #include  <sys/signal.h>
     28 
     29 /*  The type sig_atomic_t is the (possibly volatile-qualified) integer type of
     30     an object that can be accessed as an atomic entity, even in the presence
     31     of asynchronous interrupts.
     32 
     33     This, possibly machine specific, type is defined in <machine/signal.h>.
     34 */
     35 
     36 /** @{
     37     The following three macros expand to constant expressions with distinct
     38     values that have type compatible with the second argument to, and the
     39     return value of, the signal function, and whose values compare unequal to
     40     the address of any declarable function.
     41 **/
     42 #define SIG_IGN   ((__sighandler_t *) 0)
     43 #define SIG_DFL   ((__sighandler_t *) 1)
     44 #define SIG_ERR   ((__sighandler_t *) 3)
     45 /*@}*/
     46 
     47 /** @{
     48     The following macros 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     The C95 specification requires these to be macros.
     52 **/
     53 #define SIGINT     __SigInt     ///< receipt of an interactive attention signal
     54 #define SIGILL     __SigIll     ///< detection of an invalid function image, such as an invalid instruction
     55 #define SIGABRT    __SigAbrt    ///< abnormal termination, such as is initiated by the abort function
     56 #define SIGFPE     __SigFpe     ///< an erroneous arithmetic operation, such as zero divide or an operation resulting in overflow
     57 #define SIGSEGV    __SigSegv    ///< an invalid access to storage
     58 #define SIGTERM    __SigTerm    ///< a termination request sent to the program
     59 #define SIGBREAK   __SigBreak   ///< added for Python
     60 #define SIGALRM    __SigAlrm    ///< Added for Posix timer functions
     61 #define SIGVTALRM  __SigVtAlrm  ///< Added for Posix timer functions
     62 #define SIGPROF    __SigProf    ///< Added for Posix timer functions
     63 #define SIGUSR1    __SigUsr1    ///< Added for Posix timer functions
     64 #define SIGUSR2    __SigUsr2    ///< Added for Posix timer functions
     65 #define SIGWINCH   __SigWinch   ///< Added for Posix timer functions
     66 #define SIGPIPE    __SigPipe    ///< Added for Posix timer functions
     67 #define SIGQUIT    __SigQuit    ///< Added for Posix timer functions
     68 #define SIG_LAST   __Sig_Last   ///< One more than the largest signal number
     69 /*@}*/
     70 
     71 __BEGIN_DECLS
     72 
     73 /** Send a signal.
     74 
     75     The raise function carries out the actions described for signal,
     76     in <sys/signal.h>, for the signal sig. If a signal handler is called, the
     77     raise function does not return until after the signal handler does.
     78 
     79     @return   The raise function returns zero if successful,
     80               or nonzero if unsuccessful.
     81 **/
     82 int raise(int sig);
     83 
     84 __END_DECLS
     85 
     86 #endif  /* _SIGNAL_H */
     87