Article 128188 of comp.os.vms:
Path: nntpd.lkg.dec.com!pa.dec.com!decuac.dec.com!haven.umd.edu!purdue!lerc.nasa.gov!magnus.acs.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!news.sprintlink.net!in1.uu.net!news3.digex.net!dcc11293.slip.digex.net!user
From: dpm@access.digex.net (David P. Murphy)
Newsgroups: comp.os.vms
Subject: Re: UNIX signals under OpenVMS
Date: Tue, 29 Aug 1995 22:56:28 -0500
Organization: Phase of the Moon Software, Inc.
Lines: 90
Distribution: world
Message-ID: <dpm-2908952256280001@dcc11293.slip.digex.net>
References: <1995Aug25.101939.10825@walter.cray.com> <41sthp$vqu@nntpd.lkg.dec.com> <dpm-2808952220400001@dcc11293.slip.digex.net> <41v95r$eo7@nntpd.lkg.dec.com>
NNTP-Posting-Host: dcc11293.slip.digex.net

In article <41v95r$eo7@nntpd.lkg.dec.com>, cowan@rtl.enet.dec.com wrote:

> The DEC C run-time library, which ships with OpenVMS, added
> SIGUSR1 in V6.2.  It added cross-process signals, using sys$sigprc,
> in V7.0.  By added cross-process signals, I mean that the kill
> function now looks at the pid and generates a signal in that
> process.  Previously, it just stopped the process.

my apologies for confusing the issue.

as an aside, several people have requested details about $sigprc(),
so i'm appending a sample function to this message.

#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <ssdef.h>
#include <descrip.h>

extern unsigned long sys$sigprc(
        unsigned long *pidptr,
        struct dsc$descriptor *nameptr,
        unsigned long sts
);
extern unsigned long lib$signal();

unsigned long TickleOtherProcess(       /* returns a SS$_XXXX value */
        unsigned long pid,      /* r : process to tickle, used only if name is null */
        char *pname,            /* r : asciz process name to tickle */
        unsigned long sts       /* r : the condition value to be signalled in the target process */
)
{
        unsigned long cv0;
        unsigned long truepid;
        unsigned long *pidptr;
        struct dsc$descriptor *nameptr;
        struct dsc$descriptor namesd;

        /* the undocumented, unsupported system service SYS$SIGPRC() is similar
         * to the documented, supported system service SYS$FORCEX() in that both
         * invade the context of another process and place a VMS condition value
         * (really, any four-byte integer at all, since no check is performed)
         * into that process.  the difference is that $FORCEX() forces that
         * process to call SYS$EXIT() using the passed condition value, while
         * $SIGPRC() forces that process to call LIB$SIGNAL() using the passed
         * condition value --- a much less severe result.  of course, the target
         * process had better have an appropriate condition handler already
         * established, and be able to properly interpret the passed value
         * instead of just mindlessly resignalling it.  one method is to reserve
         * an entire facility for "tickle" purposes, which leaves the low
         * sixteen bits available as a raw short for when you want to pass
         * an actual number instead of a VMS condition value.
         */
        if (pname == NULL) {
                pidptr  = &truepid;
                nameptr = NULL;
                truepid = pid;
        }
        else {
                pidptr  = NULL;
                nameptr = &namesd;
                namesd.dsc$w_length  = strlen(pname);
                namesd.dsc$b_dtype   = DSC$K_DTYPE_T;
                namesd.dsc$b_class   = DSC$K_CLASS_S;
                namesd.dsc$a_pointer = pname;
        }

        /* force the other guy to signal the desired status ---
         * be sure to signal our own errors, except for
         * "non-existant process" and "no privilege" which are
         * assumed to be environmental problems instead of
         * programming errors, so let the caller worry about them
         */
        cv0 = sys$sigprc(pidptr, nameptr, sts);
        if ((cv0 & 1) == 0) {
                if (cv0 != SS$_NONEXPR && cv0 != SS$_NOPRIV) {
                        lib$signal(cv0, 0);
                }
        }

        return(cv0);
}

ok
dpm
---
David P. Murphy                    mailto:murphy@connor.datametrics.com (work)
systems programmer                 mailto:dpm@access.digex.net      (personal)
                                   ftp://ftp.digex.net/pub/access/dpm
COGITO ERGO DISCLAIMUM             http://www.access.digex.net/~dpm


