1*49147Sbostic /*- 2*49147Sbostic * Copyright (c) 1982, 1988 The Regents of the University of California. 3*49147Sbostic * All rights reserved. 4*49147Sbostic * 5*49147Sbostic * %sccs.include.proprietary.c% 6*49147Sbostic * 7*49147Sbostic * @(#)ioctl.c 7.1 (Berkeley) 05/05/91 8*49147Sbostic */ 9*49147Sbostic 10*49147Sbostic #include <sys/param.h> 11*49147Sbostic #include "saio.h" 12*49147Sbostic 13*49147Sbostic #ifndef SMALL 14*49147Sbostic ioctl(fdesc, cmd, arg) 15*49147Sbostic int fdesc, cmd; 16*49147Sbostic char *arg; 17*49147Sbostic { 18*49147Sbostic register struct iob *file; 19*49147Sbostic int error = 0; 20*49147Sbostic 21*49147Sbostic fdesc -= 3; 22*49147Sbostic if (fdesc < 0 || fdesc >= SOPEN_MAX || 23*49147Sbostic ((file = &iob[fdesc])->i_flgs&F_ALLOC) == 0) { 24*49147Sbostic errno = EBADF; 25*49147Sbostic return (-1); 26*49147Sbostic } 27*49147Sbostic switch (cmd) { 28*49147Sbostic 29*49147Sbostic case SAIOHDR: 30*49147Sbostic file->i_flgs |= F_HDR; 31*49147Sbostic break; 32*49147Sbostic 33*49147Sbostic case SAIOCHECK: 34*49147Sbostic file->i_flgs |= F_CHECK; 35*49147Sbostic break; 36*49147Sbostic 37*49147Sbostic case SAIOHCHECK: 38*49147Sbostic file->i_flgs |= F_HCHECK; 39*49147Sbostic break; 40*49147Sbostic 41*49147Sbostic case SAIONOBAD: 42*49147Sbostic file->i_flgs |= F_NBSF; 43*49147Sbostic break; 44*49147Sbostic 45*49147Sbostic case SAIODOBAD: 46*49147Sbostic file->i_flgs &= ~F_NBSF; 47*49147Sbostic break; 48*49147Sbostic 49*49147Sbostic default: 50*49147Sbostic error = devioctl(file, cmd, arg); 51*49147Sbostic break; 52*49147Sbostic } 53*49147Sbostic if (error < 0) 54*49147Sbostic errno = file->i_error; 55*49147Sbostic return (error); 56*49147Sbostic } 57*49147Sbostic #endif /* SMALL */ 58