aboutsummaryrefslogtreecommitdiff
path: root/sys/ki/kzclmt.x
blob: 6d6bbb80d2b9139227b0675d4f55ea257182f1f7 (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
41
42
43
44
45
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

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

# KZCLMT -- Close a magtape file.

procedure kzclmt (chan, devpos, status)

int	chan			#I channel to be closed
int	devpos[ARB]		#O receives position information
int	status			#O close status

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

begin
	# Possible if an abort occurs during the open.
	if (chan <= 0) {
	    status = OK
	    return
	}

	if (k_node[chan] == NULL)
	    call zzclmt (k_oschan[chan], devpos, status)
	else {
	    server   = k_node[chan]
	    p_arg[1] = k_oschan[chan]

	    if (ki_sendrcv (server, KI_ZFIOMT, MT_CL) == ERR)
		status = ERR
	    else {
		status = p_arg[1]
		call amovi (p_arg[2], devpos, LEN_MTDEVPOS)
	    }

	    call mfree (k_bufp[chan], TY_INT)
	}

	call ki_freechan (chan)
end