aboutsummaryrefslogtreecommitdiff
path: root/sys/ki/kbzcls.x
blob: afb1f348561195e3b6c0747605bcc1797338b230 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<mach.h>
include	<config.h>
include	"ki.h"

# KB_ZCLS -- Close a binary device.  We are called only if the device does not
# reside on the local node.

procedure kb_zcls (device, chan, status)

int	device			# device driver code
int	chan			# channel assigned device
int	status			# receives ok|err

int	server
int	ki_sendrcv()
include	"kichan.com"
include	"kii.com"

begin
	server   = k_node[chan]
	p_arg[1] = k_oschan[chan]

	# If we receive error on the KS channel when trying to close a file,
	# it is most likely due to a previous i/o error on the channel.  Do
	# not return error here because we are probably being called during
	# error recovery to free the logical channel, and if we return error
	# the real error will be hidden.

	if (ki_sendrcv (server, device, BF_CLS) == ERR)
	    status = OK
	else
	    status = p_arg[1]

	call ki_freechan (chan)
end