home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Kernel / Em / assert.c next >
Encoding:
C/C++ Source or Header  |  1990-08-17  |  1.0 KB  |  59 lines

  1. char EMassertMessage[] = "Assertion (%s) failed: file %s, line %d\n";
  2. #include <stdio.h>
  3. #include <sys/signal.h>
  4. #include "Kernel/h/stdTypes.h"
  5. #include "Kernel/h/system.h"
  6.  
  7. extern NodeNum GetLNN();
  8. extern void shutdownOID();
  9.  
  10. void _flushall()
  11. {
  12. #ifdef BSD
  13.   extern int fflush();
  14.   _fwalk(fflush);
  15. #endif
  16. }
  17.  
  18. extern die();
  19.  
  20. abortxx()
  21. {
  22.   _flushall();
  23. #ifdef vax
  24.   asm("    halt");
  25. #endif
  26. #ifdef sun
  27.   asm("stop    #0");
  28. #endif
  29. }
  30.  
  31. /*
  32.  * Prepare to abort.  We would like to have a core dump so we cancel all
  33.  * our signal stuff first (BSD only).
  34.  */
  35. abort()
  36. {
  37.   ErrMsg("Kernel aborting to obtain core dump\n");
  38.  
  39. #ifdef BSD
  40.   {
  41.     struct sigvec vec;    /* used in sigvec() calls */
  42.   
  43.     vec.sv_handler      = SIG_DFL;
  44.     vec.sv_mask         = 0;   /* All signals enabled */
  45.     vec.sv_onstack      = 0;         
  46.     sigvec(SIGINT, &vec, 0);   /* 0 means do not tell me old sighandler */
  47.     sigvec(SIGTERM, &vec, 0);
  48.     sigvec(SIGILL, &vec, 0);
  49.     sigvec(SIGBUS, &vec, 0);
  50.     sigvec(SIGSEGV, &vec, 0);
  51.   }
  52. #endif
  53.   
  54.   SendShutDownMsg(GetLNN());
  55.   shutdownOID();
  56.   
  57.   abortxx();
  58. }
  59.