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 * @(#)ioctl.c 7.3 (Berkeley) 05/24/93 8 */ 9 10 #include <sys/param.h> 11 #include <stand.att/saio.h> 12 13 #ifndef SMALL 14 ioctl(fdesc, cmd, arg) 15 int fdesc, cmd; 16 char *arg; 17 { 18 register struct iob *file; 19 int error = 0; 20 21 fdesc -= 3; 22 if (fdesc < 0 || fdesc >= SOPEN_MAX || 23 ((file = &iob[fdesc])->i_flgs&F_ALLOC) == 0) { 24 errno = EBADF; 25 return (-1); 26 } 27 switch (cmd) { 28 29 case SAIOHDR: 30 file->i_flgs |= F_HDR; 31 break; 32 33 case SAIOCHECK: 34 file->i_flgs |= F_CHECK; 35 break; 36 37 case SAIOHCHECK: 38 file->i_flgs |= F_HCHECK; 39 break; 40 41 case SAIONOBAD: 42 file->i_flgs |= F_NBSF; 43 break; 44 45 case SAIODOBAD: 46 file->i_flgs &= ~F_NBSF; 47 break; 48 49 default: 50 error = devioctl(file, cmd, arg); 51 break; 52 } 53 if (error < 0) 54 errno = file->i_error; 55 return (error); 56 } 57 #endif /* SMALL */ 58