aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/psioxfer.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/etc/psioxfer.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/etc/psioxfer.x')
-rw-r--r--sys/etc/psioxfer.x33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/etc/psioxfer.x b/sys/etc/psioxfer.x
new file mode 100644
index 00000000..ca286512
--- /dev/null
+++ b/sys/etc/psioxfer.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+define SZ_NUMBUF 8 # encoded count for an XFER
+
+
+# PSIO_XFER -- Transfer a data record to a process to complete an XFER
+# request. Write the byte count record followed by the data record.
+# These must be written as two separate records or deadlock
+# will occur (with the reader waiting for the second record).
+
+procedure psio_xfer (fd, buf, nchars)
+
+int fd # output file
+char buf[ARB] # buffer containing record to be written
+int nchars # length of record
+
+int ndigits
+char numbuf[SZ_NUMBUF]
+int itoc()
+
+begin
+ if (nchars >= 0) {
+ ndigits = itoc (nchars, numbuf, SZ_NUMBUF)
+ numbuf[ndigits+1] = '\n'
+ call write (fd, numbuf, ndigits + 1)
+ call flush (fd)
+
+ if (nchars > 0) {
+ call write (fd, buf, nchars)
+ call flush (fd)
+ }
+ }
+end