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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
|