diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-11-22 14:17:33 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-11-22 14:17:33 +0000 |
commit | dafb14e8a8a1d97986993216f67b5f95ccbfe922 (patch) | |
tree | 959c70a3c19ab3bbf7706eeaf8bf99051f53fb71 /usr.bin/xinstall | |
parent | a3deb2493a914dbdfd2811ba76e742fc93d2b742 (diff) |
madvise() -- take two
Diffstat (limited to 'usr.bin/xinstall')
-rw-r--r-- | usr.bin/xinstall/xinstall.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index efd558c3804..bc231e60040 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xinstall.c,v 1.38 2003/11/22 13:40:28 grange Exp $ */ +/* $OpenBSD: xinstall.c,v 1.39 2003/11/22 14:17:32 mickey Exp $ */ /* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; #endif -static char rcsid[] = "$OpenBSD: xinstall.c,v 1.38 2003/11/22 13:40:28 grange Exp $"; +static char rcsid[] = "$OpenBSD: xinstall.c,v 1.39 2003/11/22 14:17:32 mickey Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -438,6 +438,8 @@ copy(int from_fd, char *from_name, int to_fd, char *to_name, off_t size, (void)unlink(to_name); errx(EX_OSERR, "%s: %s", from_name, strerror(serrno)); } + if (size) + madvise(p, size, MADV_SEQUENTIAL); siz = (size_t)size; if ((nw = write(to_fd, p, siz)) != siz) { serrno = errno; @@ -514,6 +516,10 @@ compare(int from_fd, const char *from_name, size_t from_len, int to_fd, if ((p2 = mmap(NULL, length, PROT_READ, MAP_PRIVATE, to_fd, to_off)) == MAP_FAILED) err(EX_OSERR, "%s", to_name); + if (length) { + madvise(p1, length, MADV_SEQUENTIAL); + madvise(p2, length, MADV_SEQUENTIAL); + } dfound = memcmp(p1, p2, length); |