Path: news.mitre.org!blanket.mitre.org!philabs!newsjunkie.ans.net!newsfeeds.ans.net!news.stetson.edu!huron.eel.ufl.edu!usenet.eel.ufl.edu!www.nntp.primenet.com!globalcenter0!news.primenet.com!nntp.primenet.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!news1.digital.com!pa.dec.com!nntpd.lkg.dec.com!zk2nws.zko.dec.com!usenet
From: Boris Gubenko <boris@tle.enet.dec.com>
Newsgroups: comp.os.vms
Subject: Re: kill on OpenVMS
Date: Wed, 10 Dec 1997 19:34:49 -0400
Organization: DIGITAL
Lines: 48
Message-ID: <348EEED9.DFCDC7A@tle.enet.dec.com>
References: <349043e0.33342423@news.axion.bt.co.uk>
NNTP-Posting-Host: hndymn.zko.dec.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.03b1Gold (X11; I; OpenVMS V7.1     Digital AlphaStation 600 5/)

Greg Thomas wrote:
> 
> Hi,
> I've just ported a UNIX (yuck!) program to OpenVMS, and you can
> control it by sending signals. Of course, in UNIX it's easy - just use
> 'kill'. Is there the source for kill for OpenVMS around on the 'net
> somewhere, or will I have to roll my own, or have I missed something
> obvious?
> 
> TIA,
> 
> Greg


  While there is no kill DCL command on VMS, one can easily implement
  it using the DEC C RTL kill() function.

  Something like the following:

        #include <signal.h>
        #include <stdio.h>
        #include <stdlib.h>

        main(int argc, char *argv[])
        {
          unsigned int pid = strtoul(argv[1],NULL,16);
          int signal = strtoul(argv[2],NULL,10);

          if ( kill(pid, signal) ) {
            perror("kill");
            exit(EXIT_FAILURE);
          }

          exit(EXIT_SUCCESS);
        }

  Note, that on VMS system prior to OpenVMS V7.0 the process is unable
  to catch a signal sent by another process using the handler
established
  by the signal() function. So, on a pre-V7.0 system the target process
  will just die upon receiving a signal.

-- 
Boris Gubenko. Digital Equipment Corp. Nashua, NH.
DEC C RTL.  (603) 884-1675  boris@tle.enet.dec.com
======================================================
All the opinions voiced are mine alone and do not
reflect anyone else's opinion, including my employer's.
