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

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

# KCLDIR -- Close a directory file.

procedure kcldir (chan, status)

int	chan			# channel descriptor
int	status			# answer; ok or err

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
	}

	server = k_node[chan]

	if (server == NULL) {
	    call zcldir (k_oschan[chan], status)

	} else {
	    p_arg[1]  = k_oschan[chan]
	    p_sbuflen = 0

	    if (ki_sendrcv (server, KI_ZCLDIR, 0) == ERR)
		status = ERR
	    else
		status = p_arg[1]

	    call mfree (k_bufp[chan], TY_STRUCT)
	}

	call ki_freechan (chan)
end