diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/fio/awaitb.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/fio/awaitb.x')
-rw-r--r-- | sys/fio/awaitb.x | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sys/fio/awaitb.x b/sys/fio/awaitb.x new file mode 100644 index 00000000..3d27f748 --- /dev/null +++ b/sys/fio/awaitb.x @@ -0,0 +1,39 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <mach.h> +include <config.h> +include <fio.h> + +# AWAITB -- Wait for any pending i/o operations on a file to complete. +# Must be called after an AREADB or AWRITEB (to check for an i/o error +# and for synchronization) or an abort will result. + +int procedure awaitb (fd) + +int fd +int nbytes, nchars +include <fio.com> + +begin + fp = fiodes[fd] + + if (FFIOMODE(fp) == INACTIVE) + return (FNBYTES(fp)) + else + call zcall2 (ZAWTBF(fp), FCHAN(fp), nbytes) + + nchars = nbytes + if (nbytes >= 0) + nchars = (nbytes + SZB_CHAR-1) / SZB_CHAR + + FNBYTES(fp) = nbytes + FILSTAT(fp) = nchars + + FCIOMODE(fp) = INACTIVE # clear channel + FFIOMODE(fp) = INACTIVE # complete fd request + + if (nbytes >= 0) + return (nbytes) + else + return (ERR) +end |