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 * @(#)lseek.c 7.3 (Berkeley) 05/24/93 8 */ 9 10 #include <sys/param.h> 11 #include <stand.att/saio.h> 12 13 off_t 14 lseek(fdesc, addr, ptr) 15 int fdesc, ptr; 16 off_t addr; 17 { 18 register struct iob *io; 19 20 #ifndef SMALL 21 if (ptr != L_SET) { 22 printf("Seek not from beginning of file\n"); 23 errno = EOFFSET; 24 return (-1); 25 } 26 #endif 27 fdesc -= 3; 28 #ifndef SMALL 29 if (fdesc < 0 || fdesc >= SOPEN_MAX || 30 ((io = &iob[fdesc])->i_flgs & F_ALLOC) == 0) { 31 errno = EBADF; 32 return (-1); 33 } 34 #endif 35 io->i_offset = addr; 36 io->i_bn = addr / DEV_BSIZE; 37 io->i_cc = 0; 38 return (0); 39 } 40