diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-01-31 03:51:22 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-01-31 03:51:22 +0000 |
commit | 21d8ae059d2a81f4fd840680b415c5a415385513 (patch) | |
tree | 2dc56bfed70795261f3ce39150697306ef87d130 /lib/libc/db/hash/hash_page.c | |
parent | 8c27d4f6c9fc500439427662013e027b85a5d1c9 (diff) |
Use pread(2) and pwrite(2) instead of lseek(2) + read(2) / write(2).
Based on changes from NetBSD (thorpej).
Diffstat (limited to 'lib/libc/db/hash/hash_page.c')
-rw-r--r-- | lib/libc/db/hash/hash_page.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c index 80d6c0a81eb..0936f6a12e1 100644 --- a/lib/libc/db/hash/hash_page.c +++ b/lib/libc/db/hash/hash_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash_page.c,v 1.7 1999/02/15 05:11:24 millert Exp $ */ +/* $OpenBSD: hash_page.c,v 1.8 2002/01/31 03:51:21 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94"; #else -static char rcsid[] = "$OpenBSD: hash_page.c,v 1.7 1999/02/15 05:11:24 millert Exp $"; +static char rcsid[] = "$OpenBSD: hash_page.c,v 1.8 2002/01/31 03:51:21 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -543,8 +543,7 @@ __get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap) page = BUCKET_TO_PAGE(bucket); else page = OADDR_TO_PAGE(bucket); - if ((lseek(fd, (off_t)page << hashp->BSHIFT, SEEK_SET) == -1) || - ((rsize = read(fd, p, size)) == -1)) + if ((rsize = pread(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1) return (-1); bp = (u_int16_t *)p; if (!rsize) @@ -614,8 +613,7 @@ __put_page(hashp, p, bucket, is_bucket, is_bitmap) page = BUCKET_TO_PAGE(bucket); else page = OADDR_TO_PAGE(bucket); - if ((lseek(fd, (off_t)page << hashp->BSHIFT, SEEK_SET) == -1) || - ((wsize = write(fd, p, size)) == -1)) + if ((wsize = pwrite(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1) /* Errno is set */ return (-1); if (wsize != size) { |