diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/ki/kopdpr.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/ki/kopdpr.x')
-rw-r--r-- | sys/ki/kopdpr.x | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sys/ki/kopdpr.x b/sys/ki/kopdpr.x new file mode 100644 index 00000000..1ea62dc9 --- /dev/null +++ b/sys/ki/kopdpr.x @@ -0,0 +1,59 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <mach.h> +include "ki.h" + +# KOPDPR -- Open a detached process. + +procedure kopdpr (process, bkgfile, bkgmsg, jobcode) + +char process[ARB] # packed osfn of process executable +char bkgfile[ARB] # packed osfn of bkg file +char bkgmsg[ARB] # control string for kernel +int jobcode # receives job code of process + +pointer sp, osfn, alias +int server, off, delim +int ki_connect(), ki_sendrcv(), ki_getchan(), strlen(), ki_gnode() +include "kii.com" + +begin + call smark (sp) + call salloc (osfn, SZ_PATHNAME, TY_CHAR) + call salloc (alias, SZ_ALIAS, TY_CHAR) + + server = ki_connect (process) + + if (server == NULL) { + call strpak (p_sbuf[p_arg[1]], p_sbuf, SZ_SBUF) + call strupk (bkgfile, Memc[osfn], SZ_PATHNAME) + + # The bkg file must be on the same node as the process file. + if (ki_gnode (Memc[osfn], Memc[alias], delim) == REMOTE) + jobcode = ERR + else { + call strpak (Memc[osfn+(delim+1)-1], Memc[osfn], SZ_PATHNAME) + call zopdpr (p_sbuf, Memc[osfn], bkgmsg, jobcode) + } + + } else { + # Spawning of detached processes on remote notes is not really + # supported as of yet. Add support for passing the bkgmsg; use + # node name in bkgmsg to submit bkg job to remote node. + + off = p_sbuflen + 2 + p_arg[2] = off + call strupk (bkgfile, p_sbuf[off], ARB) + p_sbuflen = off + strlen(p_sbuf[off]) + + if (ki_sendrcv (server, KI_ZOPDPR, 0) == ERR) + jobcode = ERR + else + jobcode = p_arg[1] + } + + if (jobcode != ERR) + jobcode = ki_getchan (server, jobcode) + + call sfree (sp) +end |