date and time created 91/05/05 13:19:59 by bostic
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 6 May 1991 04:19:59 +0000 (20:19 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 6 May 1991 04:19:59 +0000 (20:19 -0800)
SCCS-vsn: sys/stand.att/close.c 7.1

usr/src/sys/stand.att/close.c [new file with mode: 0644]

diff --git a/usr/src/sys/stand.att/close.c b/usr/src/sys/stand.att/close.c
new file mode 100644 (file)
index 0000000..f3d1ecf
--- /dev/null
@@ -0,0 +1,30 @@
+/*-
+ * Copyright (c) 1982, 1988 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.proprietary.c%
+ *
+ *     @(#)close.c     7.1 (Berkeley) %G%
+ */
+
+#include <sys/param.h>
+#include "saio.h"
+
+close(fdesc)
+       int fdesc;
+{
+#ifndef SMALL
+       struct iob *file;
+
+       fdesc -= 3;
+       if (fdesc < 0 || fdesc >= SOPEN_MAX ||
+           ((file = &iob[fdesc])->i_flgs&F_ALLOC) == 0) {
+               errno = EBADF;
+               return (-1);
+       }
+       if ((file->i_flgs&F_FILE) == 0)
+               devclose(file);
+       file->i_flgs = 0;
+#endif
+       return (0);
+}