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/kbzstt.x | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sys/ki/kbzstt.x (limited to 'sys/ki/kbzstt.x') diff --git a/sys/ki/kbzstt.x b/sys/ki/kbzstt.x new file mode 100644 index 00000000..0610dd7f --- /dev/null +++ b/sys/ki/kbzstt.x @@ -0,0 +1,48 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include +include +include "ki.h" + +# KB_ZSTT -- Get file status on a binary device. We are called only if the +# device does not reside on the local node. + +procedure kb_zstt (device, chan, what, lvalue) + +int device # device driver code +int chan # channel assigned device +int what # file parameter to be returned +long lvalue # receives the parameter value + +int server, ks_maxbufsize +int ki_sendrcv() +include "kichan.com" +include "kinode.com" +include "kii.com" +data ks_maxbufsize /-1/ + +begin + server = k_node[chan] + p_arg[1] = k_oschan[chan] + p_arg[2] = what + + if (ki_sendrcv (server, device, BF_STT) == ERR) + lvalue = ERR + else { + lvalue = p_arg[1] + + # The maximum buffer (transfer) size for a device is determined + # by the the network interface or by the device, whichever is + # smaller. + + if (what == FSTT_MAXBUFSIZE || what == FSTT_OPTBUFSIZE) { + if (ks_maxbufsize < 0) + call zsttks (n_kschan[server], FSTT_MAXBUFSIZE, ks_maxbufsize) + if (lvalue == 0) + lvalue = ks_maxbufsize + else if (ks_maxbufsize > 0) + lvalue = min (lvalue, ks_maxbufsize) + } + } +end -- cgit