From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/ki/kopdpr.x | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sys/ki/kopdpr.x (limited to 'sys/ki/kopdpr.x') 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 +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 -- cgit