Example #1
0
static void
astHandler (void)
{
	if (pidToAbort) {
		sys$forcex (&pidToAbort, 0, SS$_ABORT);
		pidToAbort= 0;
	}
	kill (getpid(),SIGQUIT);
}
static int send_signal(int pid, int signal)
{
	int status;

	if (SIGUSR1 == signal)
	{	/* Currently only type of posix signal used */
		status = kill(pid, signal);
		if (-1 == status)
		{
			perror("Job Interrupt request failed: ");
			status = SS$_BADPARAM;
		} else
			status = SS$_NORMAL;
	} else
	{	/* Default signal but only ERR_FORCEDHALT currently sent */
		status = sys$forcex(&pid, 0, signal);
		if (status != SS$_NORMAL)
			rts_error(VARLSTCNT(1) status);
	}
	return status;
}
Example #3
0
/*
**++
**  ROUTINE:	sp_close
**
**  FUNCTIONAL DESCRIPTION:
**
**  	Close down a subprocess.
**
**  RETURNS:	cond_value, longword (unsigned), write only, by value
**
**  PROTOTYPE:
**
**  	sp_close(SPHANDLE *ctxpp)
**
**  IMPLICIT INPUTS:	None.
**
**  IMPLICIT OUTPUTS:	None.
**
**  COMPLETION CODES:
**  	    SS$_NORMAL:	    Normal successful completion.
**
**  SIDE EFFECTS:   	None.
**
**--
*/
unsigned int sp_close (SPHANDLE *ctxpp) {

    SPHANDLE ctx;
    struct SPD *spd;
    unsigned int status;

    ctx = *ctxpp;
/*
** Unlink the context block from our tracking queue
*/
    status = sys$setast(0);
    queue_remove(ctx, &ctx);
    while (queue_remove(ctx->sendque.head, &spd)) free_spd(spd);
    if (status == SS$_WASSET) sys$setast(1);

/*
** Delete the subprocess
*/
    sys$forcex(&ctx->pid, 0, SS$_NORMAL);
    sys$delprc(&ctx->pid, 0);

/*
** Wait till it actually dies
*/
    sys$waitfr(ctx->termefn);

/*
** Clean up and return
*/
    lib$free_ef(&ctx->termefn);
    lib$free_ef(&ctx->inefn);
    lib$free_ef(&ctx->outefn);
    sys$dassgn(ctx->inchn);
    sys$dassgn(ctx->outchn);
    lib$free_vm(&ctx->bufsiz, &ctx->bufptr);
    lib$free_vm(&spb_size, &ctx);
    return SS$_NORMAL;
} /* sp_close */