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

  1. /* sys/kill.c (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <os2emx.h>
  5. #include <signal.h>
  6. #include <errno.h>
  7. #include "syscalls.h"
  8.  
  9. int __kill (int pid, int sig)
  10. {
  11.   ULONG rc;
  12.   ULONG n;
  13.  
  14.   if (pid == __getpid ())
  15.     {
  16.       if (sig == 0)
  17.         return (0);
  18.       return (__raise (sig));
  19.     }
  20.   else if (sig == SIGINT || sig == SIGBREAK)
  21.     {
  22.       if (sig == SIGINT)
  23.         n = XCPT_SIGNAL_INTR;
  24.       else
  25.         n = XCPT_SIGNAL_BREAK;
  26.       rc = DosSendSignalException (pid, n);
  27.       if (rc != 0)
  28.         {
  29.           _sys_set_errno (rc);
  30.           return (-1);
  31.         }
  32.       return (0);
  33.     }
  34.   errno = EINVAL;
  35.   return (-1);
  36. }
  37.