home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / SYS / RAISE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  737 b   |  37 lines

  1. /* sys/raise.c (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <os2emx.h>
  5. #include <string.h>
  6. #include <signal.h>
  7. #include <errno.h>
  8. #include "syscalls.h"
  9. #include "syssig.h"
  10.  
  11. int __raise (int sig)
  12. {
  13.   ULONG rc;
  14.   EXCEPTIONREPORTRECORD rep;
  15.  
  16.   if (sig < 1 || sig >= NSIG)
  17.     {
  18.       errno = EINVAL;
  19.       return (-1);
  20.     }
  21.   if (_sys_sig_ack_req[sig])
  22.     _sys_sig_pending[sig] = 1;
  23.   else
  24.     {
  25.       _sys_sig_ack_req[sig] = 1;
  26.       memset (&rep, 0, sizeof (rep));
  27.       rep.ExceptionNum = SIG2X (sig);
  28.       rc = DosRaiseException (&rep);
  29.       if (rc != 0)
  30.         {
  31.           _sys_set_errno (rc);
  32.           return (-1);
  33.         }
  34.     }
  35.   return (0);
  36. }
  37.