2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1997, 1998
5 * Sleepycat Software. All rights reserved.
11 static const char sccsid
[] = "@(#)os_seek.c 10.11 (Sleepycat) 10/12/98";
14 #ifndef NO_SYSTEM_INCLUDES
15 #include <sys/types.h>
26 * Seek to a page/byte offset in the file.
28 * PUBLIC: int __os_seek __P((int, size_t, db_pgno_t, u_int32_t, int, int));
31 __os_seek(fd
, pgsize
, pageno
, relative
, isrewind
, whence
)
41 if (__db_jump
.j_seek
!= NULL
)
42 ret
= __db_jump
.j_seek(fd
,
43 pgsize
, pageno
, relative
, isrewind
, whence
);
45 offset
= (off_t
)pgsize
* pageno
+ relative
;
49 ret
= lseek(fd
, offset
, whence
);
51 return (ret
== -1 ? errno
: 0);