File: prkill.x

package info (click to toggle)
iraf 2.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,000 kB
  • sloc: ansic: 115,890; fortran: 74,576; lisp: 18,888; yacc: 5,642; sh: 961; lex: 596; makefile: 509; asm: 159; csh: 54; xml: 33; sed: 4
file content (42 lines) | stat: -rw-r--r-- 1,171 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<knet.h>
include	<config.h>
include	<syserr.h>

define	NOKILL		NO
define	KILL		YES

# PRKILL -- Kill a detached process.  Control does not return until the process
# has terminated, unless the kill fails for some reason.  If the process exists
# and is terminated by the kill directive, the exit status is left in the
# process table for return by PRCLDPR.

procedure prkill (job)

int	job			# slot number of job in prd.com table
include	"prd.com"
errchk	syserr

begin
	# Kill the process if there is such a process and it is still active.
	# It is an error to try to kill a nonexistent process or a process
	# which has already been killed.

	if (pr_jobcode[job] == NULL)
	    call syserr (SYS_PRBKGNF)
	else if (pr_active[job] == NO)
	    call syserr (SYS_PRBKGNOKILL)
	else {
	    call zcldpr (pr_jobcode[job], KILL, pr_exit_status[job])
	    if (pr_exit_status[job] == ERR)
		call syserr (SYS_PRBKGNOKILL)
	    else
		pr_active[job] = NO
	}

	# Delete the bkgfile if the process has not already done so during
	# shutdown.
	iferr (call delete (Memc[pr_bkgfile[job]]))
	    ;
end