aboutsummaryrefslogtreecommitdiff
path: root/sys/ki/kienvreset.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/ki/kienvreset.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/ki/kienvreset.x')
-rw-r--r--sys/ki/kienvreset.x69
1 files changed, 69 insertions, 0 deletions
diff --git a/sys/ki/kienvreset.x b/sys/ki/kienvreset.x
new file mode 100644
index 00000000..5a69c519
--- /dev/null
+++ b/sys/ki/kienvreset.x
@@ -0,0 +1,69 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include <config.h>
+include "ki.h"
+
+# KI_ENVRESET -- Update the value of an environment variable on all currently
+# connected nodes.
+
+procedure ki_envreset (name, value)
+
+char name[ARB] #I name of environment variable
+char value[ARB] #I value of environment variable
+
+pointer sp, buf, op
+int node, junk, ch
+int gstrcpy(), ki_send()
+bool streq()
+
+include "kii.com"
+include "kinode.com"
+define quit_ 91
+
+begin
+ # Do not propagate the host-specific iraf definitions "iraf", "host",
+ # and "tmp" over the network.
+
+ ch = name[1]
+ if (ch == 'i' || ch == 'h' || ch == 't')
+ if (streq(name,"iraf") || streq(name,"host") || streq(name,"tmp"))
+ return
+
+ call smark (sp)
+ call salloc (buf, SZ_COMMAND, TY_CHAR)
+
+ # Format the SET statement to be sent to each node.
+ op = buf + gstrcpy ("set ", Memc[buf], SZ_COMMAND)
+ op = op + gstrcpy (name, Memc[op], SZ_COMMAND - 4)
+ Memc[op] = '='; op = op + 1
+ Memc[op] = '"'; op = op + 1
+ op = op + gstrcpy (value, Memc[op], SZ_COMMAND - (op - buf))
+ Memc[op] = '"'; op = op + 1
+ Memc[op] = '\n'; op = op + 1
+ Memc[op] = EOS
+
+ # Transmit the SET statement to each node currently running a kernel
+ # server process. This is done without reading back a status value
+ # to permit pipelining of multiple set environment packets.
+
+ for (node=1; node <= n_nnodes; node=node+1) {
+ if (n_kschan[node] == NULL)
+ next
+
+ # Set up control packet.
+ p_sbuflen = gstrcpy (Memc[buf], p_sbuf, SZ_SBUF)
+ p_arg[1] = p_sbuflen
+
+ # Transmit packet.
+ if (ki_send (node, KI_ENVINIT, 0) == ERR)
+ goto quit_
+ }
+
+ call sfree (sp)
+ return
+quit_
+ call zclsks (n_kschan[node], junk)
+ n_kschan[node] = NULL
+ call sfree (sp)
+end