home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / unixlib / h / sigstate < prev    next >
Encoding:
Text File  |  2004-09-24  |  3.0 KB  |  98 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/unixlib/sigstate.h,v $
  4.  * $Date: 2004/09/23 22:16:39 $
  5.  * $Revision: 1.7 $
  6.  * $State: Exp $
  7.  * $Author: joty $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /* This is an internal UnixLib header file for implementing the signal
  12.    handlers.  These functions cannot be used in a user program.  */
  13.  
  14. #ifndef __UNIXLIB_SIGSTATE_H
  15. #define __UNIXLIB_SIGSTATE_H 1
  16.  
  17. #ifndef __UNIXLIB_FEATURES_H
  18. #include <unixlib/features.h>
  19. #endif
  20.  
  21. #ifndef __SIGNAL_H
  22. #include <signal.h>
  23. #endif
  24.  
  25. __BEGIN_DECLS
  26.  
  27. #define __SIG_INVALID_P(sig) ((unsigned int)sig >= NSIG)
  28.  
  29. /* Signal state for each thread.  */
  30.  
  31. struct unixlib_sigstate
  32.   {
  33.     /* The blocked signals for this process.  */
  34.     sigset_t blocked;
  35.     /* The pending signals for this process.  */
  36.     sigset_t pending;
  37.     /* The defined signal handlers for this process.  */
  38.     struct sigaction actions[NSIG];
  39.     struct sigaltstack signalstack;
  40.  
  41.     /* If `suspended' is set when this process gets a signal,
  42.        the signal thread sends an empty message to it.  */
  43.     int suspended;
  44.  
  45.     /* If 'currently_handling' is set, then the process is currently
  46.        executing a signal handler. Any raised signals will be pended and
  47.        executed after the current signal has finished executing.  */
  48.     int currently_handling;
  49.   };
  50.  
  51. /* Raise a signal as described by __signo on the process whose sigstate
  52.    __ss points to. If __ss is null, this will affect the calling process.  */
  53. extern void __unixlib_raise_signal (struct unixlib_sigstate *__ss,
  54.                    int __signo);
  55.  
  56. /* Function run for SIGINFO when its action is SIG_DFL and the current
  57.    process is the session leader.  */
  58. extern void __unixlib_siginfo_handler (int);
  59.  
  60. /* Actual signal execution functions. Depends on whether we are
  61.    using sigstack, sigaltstack or not.  */
  62. extern void __unixlib_exec_sig (__sighandler_t, int);
  63. extern void __unixlib_exec_sigstack_bsd (void *__sp, __sighandler_t, int);
  64. extern void __unixlib_exec_sigstack (void *__sp, int size, __sighandler_t, int);
  65. extern void __unixlib_default_sigaction (struct unixlib_sigstate *);
  66.  
  67. /* Helper C function for signal handler */
  68. extern void __write_unrecoverable(const char *errmess);
  69.  
  70. /* Returns non-zero value when address range __lower - __upper (excl) is
  71.    a valid address range.  */
  72. extern int valid_address (const int *__lower, const int *__upper);
  73.  
  74. /* SIGALRM handler.  */
  75. extern void __h_sigalrm_init (void);
  76.  
  77. /* SIGVTALRM handler.  */
  78. extern void __h_sigvtalrm_init (void);
  79.  
  80. /* SIGPROF handler.  */
  81. extern void __h_sigprof_init (void);
  82.  
  83. /* Alarm semaphores.  */
  84. extern int __h_sigprof_sema, __h_sigvtalrm_sema, __h_sigalrm_sema;
  85.  
  86. /* Details for stack backtraces and core dumps.  */
  87.  
  88. /* Generate a stack backtrace, __fp is the value of the
  89.    current frame pointer. */
  90. extern void __backtrace (const unsigned int *__fp);
  91.  
  92. /* Generate a core dump, from the current frame pointer.  */
  93. extern void __core (void);
  94.  
  95. __END_DECLS
  96.  
  97. #endif
  98.