aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/gki/gkiflush.x
blob: 878502d432e70f7e6ab354754447ab5552dd8adc (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
33
34
35
36
37
38
39
40
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<config.h>
include	<fio.h>
include	<gki.h>

# GKI_FLUSH -- Flush any buffered output.
#
# BOI GKI_FLUSH 0
#    
#        L(i)            set to the constant 3 (no data fields)

procedure gki_flush (fd)

int	fd			# output file

int	epa
short	gki[GKI_FLUSH_LEN]
data	gki[1] /BOI/, gki[2] /GKI_FLUSH/, gki[3] /LEN_GKIHDR/
errchk	write, seek
include	"gki.com"

begin
	if (IS_INLINE(fd)) {
	    epa = gk_dd[GKI_FLUSH]
	    if (epa != 0)
		call zcall1 (epa, 0)
	} else {
	    call write (gk_fd[fd], gki, GKI_FLUSH_LEN * SZ_SHORT)

	    # If writing to a subkernel we must call PR_PSIO to give the
	    # kernel a chance to read the spooled metacode.

	    if (IS_SUBKERNEL(fd)) {
		call seek (fd, BOFL)
		call zcall3 (gk_prpsio, KERNEL_PID(fd), fd, FF_WRITE)
	    } else
		call flush (gk_fd[fd])
	}
end