home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !gcc / include / libscl / h / signal < prev    next >
Encoding:
Text File  |  2006-09-17  |  3.3 KB  |  103 lines

  1. /* signal.h standard header for the RISC OS SharedCLibrary.
  2.    Copyright (c) 1997-2005 Nick Burrett
  3.    All rights reserved.
  4.  
  5.    Redistribution and use in source and binary forms, with or without
  6.    modification, are permitted provided that the following conditions
  7.    are met:
  8.    1. Redistributions of source code must retain the above copyright
  9.       notice, this list of conditions and the following disclaimer.
  10.    2. Redistributions in binary form must reproduce the above copyright
  11.       notice, this list of conditions and the following disclaimer in the
  12.       documentation and/or other materials provided with the distribution.
  13.    3. The name of the author may not be used to endorse or promote products
  14.       derived from this software without specific prior written permission.
  15.  
  16.    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17.    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18.    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19.    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  20.    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21.    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22.    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23.    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24.    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25.    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  26.  
  27. #ifndef __SIGNAL_H
  28. #define __SIGNAL_H
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. /* Reading and writing this data type is guaranteed to
  35.    happen in a single instruction, so there's no way for
  36.    a handler to run in the middle of an access.  */
  37. typedef int sig_atomic_t;
  38.  
  39. extern void __default_signal_handler (int);
  40. extern void __error_signal_marker (int);
  41. extern void __ignore_signal_handler (int);
  42.  
  43. /* Specifies the default action for the particular signal.  */
  44. #define SIG_DFL &__default_signal_handler
  45.  
  46. /* Used to flag error return from signal.  */
  47. #define SIG_ERR &__error_signal_marker
  48.  
  49. /* Specifies that the signal should be ignored.  */
  50. #define SIG_IGN &__ignore_signal_handler
  51.  
  52. /* Defined signals.  */
  53.  
  54. /* Indicates an error detected by the program itself and reported
  55.    by calling abort().  */
  56. #define SIGABRT 1
  57.  
  58. /* Fatal arithmetic error i.e. all arithmetic errors, including
  59.    division by zero and overflow.  */
  60. #define SIGFPE 2
  61.  
  62. /* Illegal instruction.  */
  63. #define SIGILL 3
  64.  
  65. /* The program interrupt signal is sent when the user types the
  66.    INTR character, usually Escape.  */
  67. #define SIGINT 4
  68.  
  69. /* Signal generated when a program tries to read/write outside the
  70.    memory that is allocated to it, or to write memory that can only
  71.    be read.  */
  72. #define SIGSEGV 5
  73.  
  74. /* Generic signal used to cause program termination.  */
  75. #define SIGTERM 6
  76.  
  77. /* Stack overflow.  */
  78. #define SIGSTAK 7
  79.  
  80. /* User definable signal.  */
  81. #define SIGUSR1 8
  82.  
  83. /* User definable signal.  */
  84. #define SIGUSR2 9
  85.  
  86. /* Operating system error.  */
  87. #define SIGOSERROR 10
  88.  
  89. typedef void Handler (int);
  90.  
  91. /* Define the function 'action' to be called when 'signum' is raised.  */
  92. extern Handler *signal (int __signum, Handler *__action);
  93.  
  94. /* Sends the signal 'sig' to the executing program. Returns zero on
  95.    success, non-zero on failure.  */
  96. extern int raise (int __sig);
  97.  
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101.  
  102. #endif
  103.