Commit | Line | Data |
---|---|---|
11866348 | 1 | /*- |
80409bdc KB |
2 | * Copyright (c) 1982, 1988, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
11866348 KB |
4 | * |
5 | * %sccs.include.proprietary.c% | |
6 | * | |
80409bdc | 7 | * @(#)lseek.c 8.1 (Berkeley) %G% |
11866348 KB |
8 | */ |
9 | ||
10 | #include <sys/param.h> | |
434c1e16 | 11 | #include <stand.att/saio.h> |
11866348 | 12 | |
434c1e16 | 13 | off_t |
11866348 KB |
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 | } |