date and time created 91/05/05 13:20:15 by bostic
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 6 May 1991 04:20:15 +0000 (20:20 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 6 May 1991 04:20:15 +0000 (20:20 -0800)
SCCS-vsn: sys/stand.att/lseek.c 7.1

usr/src/sys/stand.att/lseek.c [new file with mode: 0644]

diff --git a/usr/src/sys/stand.att/lseek.c b/usr/src/sys/stand.att/lseek.c
new file mode 100644 (file)
index 0000000..0071873
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 1982, 1988 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.proprietary.c%
+ *
+ *     @(#)lseek.c     7.1 (Berkeley) %G%
+ */
+
+#include <sys/param.h>
+#include "saio.h"
+
+lseek(fdesc, addr, ptr)
+       int fdesc, ptr;
+       off_t addr;
+{
+       register struct iob *io;
+
+#ifndef SMALL
+       if (ptr != L_SET) {
+               printf("Seek not from beginning of file\n");
+               errno = EOFFSET;
+               return (-1);
+       }
+#endif
+       fdesc -= 3;
+#ifndef SMALL
+       if (fdesc < 0 || fdesc >= SOPEN_MAX ||
+           ((io = &iob[fdesc])->i_flgs & F_ALLOC) == 0) {
+               errno = EBADF;
+               return (-1);
+       }
+#endif
+       io->i_offset = addr;
+       io->i_bn = addr / DEV_BSIZE;
+       io->i_cc = 0;
+       return (0);
+}