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_rw.c 10.7 (Sleepycat) 4/10/98";
14 #ifndef NO_SYSTEM_INCLUDES
15 #include <sys/types.h>
25 * Read from a file handle.
27 * PUBLIC: int __db_read __P((int, void *, size_t, ssize_t *));
30 __db_read(fd
, addr
, len
, nrp
)
41 offset
= 0; offset
< len
; taddr
+= nr
, offset
+= nr
) {
42 if ((nr
= __os_read(fd
, taddr
, len
- offset
)) < 0)
47 *nrp
= taddr
- (u_int8_t
*)addr
;
53 * Write to a file handle.
55 * PUBLIC: int __db_write __P((int, void *, size_t, ssize_t *));
58 __db_write(fd
, addr
, len
, nwp
)
69 offset
= 0; offset
< len
; taddr
+= nw
, offset
+= nw
)
70 if ((nw
= __os_write(fd
, taddr
, len
- offset
)) < 0)