aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/propdpr.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/etc/propdpr.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/etc/propdpr.x')
-rw-r--r--sys/etc/propdpr.x68
1 files changed, 68 insertions, 0 deletions
diff --git a/sys/etc/propdpr.x b/sys/etc/propdpr.x
new file mode 100644
index 00000000..79690a60
--- /dev/null
+++ b/sys/etc/propdpr.x
@@ -0,0 +1,68 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <knet.h>
+include <config.h>
+include <syserr.h>
+
+# PROPDPR -- Open a detached process. A detached process runs independently of
+# and asynchronous with the parent, with no direct communications (i.e., like
+# the IPC channels of connected subprocesses). The bkgfile is prepared by the
+# parent and read by the detached process, telling the detached process what
+# to do. There are no restrictions on the format or contents of the bkgfile
+# other than those placed by the implementor of the two processes (either a
+# text or binary file may be used). Deletion of the bkgfile is however assumed
+# to signify that the bkg process has terminated.
+
+int procedure propdpr (process, bkgfile, bkgmsg)
+
+char process[ARB] # vfn of executable process file
+char bkgfile[ARB] # vfn of background file
+char bkgmsg[ARB] # control string for kernel
+
+bool first_time
+int jobcode, pr
+pointer sp, process_osfn, bkgfile_osfn, pk_bkgmsg
+data first_time /true/
+errchk fmapfn, syserrs, malloc
+include "prd.com"
+
+begin
+ call smark (sp)
+ call salloc (process_osfn, SZ_PATHNAME, TY_CHAR)
+ call salloc (bkgfile_osfn, SZ_PATHNAME, TY_CHAR)
+ call salloc (pk_bkgmsg, SZ_LINE, TY_CHAR)
+
+ # First time initialization of the job table.
+ if (first_time) {
+ do pr = 1, MAX_BKGJOBS
+ pr_jobcode[pr] = NULL
+ first_time = false
+ }
+
+ # Get job slot.
+ for (pr=1; pr <= MAX_BKGJOBS; pr=pr+1)
+ if (pr_jobcode[pr] == NULL)
+ break
+ if (pr > MAX_BKGJOBS)
+ call syserrs (SYS_PRBKGOVFL, process)
+
+ # Map file names.
+ call fmapfn (process, Memc[process_osfn], SZ_PATHNAME)
+ call fmapfn (bkgfile, Memc[bkgfile_osfn], SZ_PATHNAME)
+ call strpak (bkgmsg, Memc[pk_bkgmsg], SZ_LINE)
+
+ # Spawn or enqueue detached process.
+ call zopdpr (Memc[process_osfn], Memc[bkgfile_osfn], Memc[pk_bkgmsg],
+ jobcode)
+ if (jobcode == ERR)
+ call syserrs (SYS_PRBKGOPEN, process)
+
+ # Set up bkg job descriptor.
+ pr_jobcode[pr] = jobcode
+ pr_active[pr] = YES
+ call malloc (pr_bkgfile[pr], SZ_FNAME, TY_CHAR)
+ call strcpy (bkgfile, Memc[pr_bkgfile[pr]], SZ_FNAME)
+
+ call sfree (sp)
+ return (pr)
+end