Cross Reference: os_seek.c
xref
: /
osnet-11
/
usr
/
src
/
cmd
/
sendmail
/
db
/
os
/
os_seek.c
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1
N/A
/*-
1
N/A
* See the file LICENSE for redistribution information.
1
N/A
*
1
N/A
* Copyright (c) 1997, 1998
1
N/A
* Sleepycat Software. All rights reserved.
1
N/A
*/
1
N/A
1
N/A
#
include
"
config.h
"
1
N/A
1
N/A
#
ifndef
lint
1
N/A
static
const
char
sccsid
[] =
"@(#)
os_seek.c
10.11 (Sleepycat) 10/12/98"
;
1
N/A
#
endif
/* not lint */
1
N/A
1
N/A
#
ifndef
NO_SYSTEM_INCLUDES
1
N/A
#
include
<
sys
/
types.h
>
1
N/A
1
N/A
#
include
<
errno.h
>
1
N/A
#
include
<
unistd.h
>
1
N/A
#
endif
1
N/A
1
N/A
#
include
"
db_int.h
"
1
N/A
#
include
"
os_jump.h
"
1
N/A
1
N/A
/*
1
N/A
* __os_seek --
1
N/A
* Seek to a
page
/
byte
offset in the file.
1
N/A
*
1
N/A
* PUBLIC: int __os_seek __P((int, size_t, db_pgno_t, u_int32_t, int, int));
1
N/A
*/
1
N/A
int
1
N/A
__os_seek
(
fd
,
pgsize
,
pageno
,
relative
,
isrewind
,
whence
)
1
N/A
int
fd
;
1
N/A
size_t
pgsize
;
1
N/A
db_pgno_t
pageno
;
1
N/A
u_int32_t
relative
;
1
N/A
int
isrewind
,
whence
;
1
N/A
{
1
N/A
off_t
offset
;
1
N/A
int
ret
;
1
N/A
1
N/A
if
(
__db_jump
.
j_seek
!=
NULL
)
1
N/A
ret
=
__db_jump
.
j_seek
(
fd
,
1
N/A
pgsize
,
pageno
,
relative
,
isrewind
,
whence
);
1
N/A
else
{
1
N/A
offset
= (
off_t
)
pgsize
*
pageno
+
relative
;
1
N/A
if
(
isrewind
)
1
N/A
offset
= -
offset
;
1
N/A
1
N/A
ret
=
lseek
(
fd
,
offset
,
whence
);
1
N/A
}
1
N/A
return
(
ret
== -
1
?
errno
: 0);
1
N/A
}