1 /*- 2 * Copyright (c) 1982, 1988 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 * 7 * @(#)close.c 7.3 (Berkeley) 05/24/93 8 */ 9 10 #include <sys/param.h> 11 #include <stand.att/saio.h> 12 13 close(fdesc) 14 int fdesc; 15 { 16 #ifndef SMALL 17 struct iob *file; 18 19 fdesc -= 3; 20 if (fdesc < 0 || fdesc >= SOPEN_MAX || 21 ((file = &iob[fdesc])->i_flgs&F_ALLOC) == 0) { 22 errno = EBADF; 23 return (-1); 24 } 25 if ((file->i_flgs&F_FILE) == 0) 26 devclose(file); 27 file->i_flgs = 0; 28 #endif 29 return (0); 30 } 31