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/kigchan.x | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sys/ki/kigchan.x (limited to 'sys/ki/kigchan.x') diff --git a/sys/ki/kigchan.x b/sys/ki/kigchan.x new file mode 100644 index 00000000..aa7c4332 --- /dev/null +++ b/sys/ki/kigchan.x @@ -0,0 +1,38 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include "ki.h" + +# KI_GETCHAN -- Find the first empty slot in the channel descriptor table +# and return its index, initializing the server and oschan fields with the +# values given. + +int procedure ki_getchan (server, oschan) + +int server # kernel server node +int oschan # os channel (iraf kernel channel) + +int i +include "kichan.com" +include "kinode.com" + +begin + # Server=0 if local node. + if (server > 0) + n_nrefs[server] = n_nrefs[server] + 1 + + do i = FIRST_CHAN, MAX_CHANNELS + if (k_oschan[i] == NULL) { + # Initialize channel descriptor. + + k_node[i] = server + k_oschan[i] = oschan + k_status[i] = 0 + k_bufp[i] = NULL + + return (i) + } + + # The following cannot happen unless something is very wrong. + call sys_panic (0, "ki_getchan: out of channel slots") +end -- cgit