home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / radi116c.zip / radius116c / src / radius / kill.c < prev    next >
C/C++ Source or Header  |  1997-01-30  |  798b  |  40 lines

  1. /* kill.c */
  2.  
  3. #define INCL_DOSEXCEPTIONS
  4. #define INCL_KBD
  5. #define INCL_NOPM          /* No Presentation manager files */
  6. #define INCL_BASE
  7. #include <os2.h>
  8. #include <errno.h>
  9. #include <signal.h>
  10. #include <process.h>
  11.  
  12. int kill (int pid, int sig)
  13. {
  14.   ULONG rc;
  15.   ULONG n;
  16.  
  17.   if (pid == getpid ())
  18.     {
  19.       if (sig == 0)
  20.         return 0;
  21.       return raise (sig);
  22.     }
  23.   else if (sig == SIGINT || sig == SIGBREAK)
  24.     {
  25.       if (sig == SIGINT)
  26.         n = XCPT_SIGNAL_INTR;
  27.       else
  28.         n = XCPT_SIGNAL_BREAK;
  29.       rc = DosSendSignalException (pid, n);
  30.       if (rc != 0)
  31.         {
  32.           errno = rc; /*  _sys_set_errno (rc);  OS/2 equiv? ***************** */
  33.           return -1;
  34.         }
  35.       return 0;
  36.     }
  37.   errno = EINVAL;
  38.   return -1;
  39. }
  40.