home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / famapi.zip / INCLUDE.ZIP / SIGNAL.H < prev    next >
C/C++ Source or Header  |  1993-06-13  |  4KB  |  117 lines

  1. //
  2. //      **************************************************************
  3. //       JdeBP C++ Library Routines      General Public Licence v1.00
  4. //          Copyright (c) 1991,1992  Jonathan de Boyne Pollard
  5. //      **************************************************************
  6. //
  7. //  SIGNAL HANDLING (ANSI and POSIX)
  8. //
  9.  
  10. #if !defined(___STDDEF_H_INCLUDED)
  11. #include <_stddef.h>
  12. #endif
  13.  
  14. //
  15. //  Action classes (must not be equivalent to any declarable function)
  16. //
  17.  
  18. #define SIG_DFL     (void (_CDECL *)(int))raise     /* default signal action    */
  19. #define SIG_ERR     (void (_CDECL *)(int))-1        /* signal() error return    */
  20. #define SIG_IGN     (void (_CDECL *)(int))signal    /* ignore signal action     */
  21.  
  22. #if _POSIX1_SOURCE > 0
  23.  
  24. //
  25. //  Signal sets (may be an integral or a structure type).
  26. //
  27. #ifndef _SIGSET_T_DEFINED
  28. typedef _Sigset_t sigset_t ;
  29. #define _SIGSET_T_DEFINED
  30. #endif
  31.  
  32. //
  33. //  Signal actions
  34. //
  35.  
  36. #ifndef _STRUCT_SIGACTION_DEFINED
  37. struct sigaction {
  38.     void    (_CDECL *sa_handler)(int) ; // Handling function
  39.     sigset_t    sa_mask ;               // Mask during handling
  40.     int         sa_flags ;              // SIGCHLD specific
  41. } ;
  42. #define _STRUCT_SIGACTION_DEFINED
  43. #endif
  44.  
  45. //
  46. //  How to alter signal sets for sigprocmask()
  47. //
  48. #define SIG_BLOCK   (void (_CDECL *)(int))1
  49. #define SIG_UNBLOCK (void (_CDECL *)(int))2
  50. #define SIG_SETMASK (void (_CDECL *)(int))3
  51.  
  52. #endif
  53.  
  54. //
  55. //  Signal numbers (must be positive and less than log2(ULONG_MAX))
  56. //
  57.  
  58. //
  59. //  Default action is termination or ignore
  60. //
  61. #define SIGABRT     1   /* Abnormal program termination */
  62. #define SIGFPE      2   /* Erroneous arithmetic operation */
  63. #define SIGILL      3   /* Invalid function image */
  64. #define SIGINT      4   /* Interactive attention signal */
  65. #define SIGSEGV     5   /* Invalid access to (internal) storage */
  66. #define SIGTERM     6   /* Program termination request */
  67. #if _POSIX1_SOURCE > 0
  68. //
  69. //  Default action is termination
  70. //
  71. #define SIGALRM     7   /* Timeout */
  72. #define SIGHUP      8   /* Hangup on controlling terminal */
  73. #define SIGKILL     9   /* Forcible termination */
  74. #define SIGPIPE     10  /* Write on broken pipe */
  75. #define SIGQUIT     11  /* Interactive termination signal */
  76. #define SIGUSR1     12  /* User defined 1 */
  77. #define SIGUSR2     13  /* User defined 2 */
  78. //
  79. //  Default action is ignore
  80. //
  81. #define SIGCHLD     14  /* Child process stopped or terminated */
  82. #define SIGCONT     15  /* Continuation */
  83. //
  84. //  Default action is stop the process
  85. //
  86. #define SIGSTOP     16  /* Forcible stop */
  87. #define SIGTSTP     17  /* Interactive stop */
  88. #define SIGTTIN     18  /* Read from tty in background */
  89. #define SIGTTOU     19  /* Write to tty in background */
  90. #endif
  91.  
  92. #ifndef _SIG_ATOMIC_T_DEFINED
  93. typedef volatile unsigned char sig_atomic_t;
  94. #define _SIG_ATOMIC_T_DEFINED
  95. #endif
  96.  
  97. extern "C" {
  98.  
  99. int     _CDECL  raise       (int);
  100. void    (_CDECL * signal    (int, void (_CDECL *)(int)))(int);
  101.  
  102. #if _POSIX1_SOURCE > 0
  103. int     _CDECL  sigemptyset (sigset_t *) ;
  104. int     _CDECL  sigfillset  (sigset_t *) ;
  105. int     _CDECL  sigaddset   (sigset_t *, int) ;
  106. int     _CDECL  sigdelset   (sigset_t *, int) ;
  107. int     _CDECL  sigismember (const sigset_t *, int) ;
  108.  
  109. int     _CDECL  sigaction   (int, struct sigaction *, struct sigaction *) ;
  110. int     _CDECL  sigprocmask (int, sigset_t *, sigset_t *) ;
  111. int     _CDECL  sigpending  (sigset_t *) ;
  112.  
  113. int     _CDECL  sigsuspend  (sigset_t *) ;
  114. #endif
  115.  
  116. }
  117.