aboutsummaryrefslogtreecommitdiff
path: root/sys/fmio/fmlfbwt.x
blob: 2310c28175dec9a92a8925c64b8c96bd9c5f45d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<knet.h>
include	"fmio.h"

# FM_LFBINWAIT -- Wait for i/o on a binary lfile.

procedure fm_lfbinwait (lf, status)

pointer	lf			#I lfile descriptor
int	status			#O i/o status (nbytes transferred or ERR)

pointer	fm
int	chan

begin
	fm = LF_FM(lf)
	chan = FM_CHAN(fm)

	# Wait for i/o and increment byte count.
	if (and (LF_FLAGS(lf), LFF_IOINPROGRESS) != 0) {
	    call zawtbf (chan, status)
	    if (status >= 0)
		LF_STATUS(lf) = LF_STATUS(lf) + min(LF_LTSIZE(lf),status)
	    else
		LF_STATUS(lf) = ERR
	    LF_FLAGS(lf) = and (LF_FLAGS(lf), not(LFF_IOINPROGRESS))
	}

	call fmio_tick (fm)
	status = LF_STATUS(lf)
end