[Deutsche Version]

Undocumented OpenVMS: SYS$SIGPRC

This routine sends a signal to a process similar to the C-RTL kill function introduced with OpenVMS 7.x.
The function prototype looks like this:
int sys$sigprc(int *pid, struct dsc$descriptor_s *prcname, int code);

Special PID values

PID=0 sends a signal to your own process. Unlike from what one might expect from the behaviour of UNIX kill, a PID less than zero results in a NONEXPR, non existant process error (independent of the privileges the current process holds).

Privilege checking

Concerning privilege checking sys$sigprc seems to behave like sys$forcex, the status will be returned in R0 with the error code (at least if you did not kill your own process using PID 0 ;-)

Privileges UICs Result
NETMBX, TMPMBX same UIC, subprocess Signalled
NETMBX, TMPMBX same UIC, diff jobs, batch, etc. Signalled
NETMBX, TMPMBX same group, diff UIC NOPRIV
NETMBX, TMPMBX completly different UIC NOPRIV
+GROUP same group, diff UIC Signalled
+GROUP completly different UIC NOPRIV
+WORLD completly different UIC Signalled

Example Code

/* test sys$sigprc, sends a SS$_ABORT to selected process */
#include <stdio.h>
#include <descrip.h>
#include <ssdef.h>
#include <lib$routines.h>

int
main(int argc, char* argv[])
{
  int pid=0, iss;
  int sys$sigprc(int *pid, struct dsc$descriptor_s *prcname, int code);
  
  if (argc < 2) {
    printf("Usage: sigprc PID\n");
    return SS$_NORMAL;
  }
  sscanf(argv[1], "%x", &pid);
  
  printf("Sending ABORT to PID %08x\n",pid);
  
  iss = sys$sigprc(&pid,0,SS$_ABORT);
  if (!(iss&1)) lib$signal(iss);
  return SS$_NORMAL;
}

 Valid CSS! [HTML 4.0 Checked!] [Viewable With Any Browser]

Comments to: Martin P.J. Zinser
Last modified: 20020628