Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/cmp * Hint MADV_SEQUENTIAL.



details:   https://anonhg.NetBSD.org/src/rev/cff05d81ccd6
branches:  trunk
changeset: 483902:cff05d81ccd6
user:      kleink <kleink%NetBSD.org@localhost>
date:      Mon Mar 20 18:23:26 2000 +0000

description:
* Hint MADV_SEQUENTIAL.
* -1 -> MAP_FAILED.

diffstat:

 usr.bin/cmp/regular.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 1da5fa52f3f2 -r cff05d81ccd6 usr.bin/cmp/regular.c
--- a/usr.bin/cmp/regular.c     Mon Mar 20 18:16:16 2000 +0000
+++ b/usr.bin/cmp/regular.c     Mon Mar 20 18:23:26 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: regular.c,v 1.7 1998/08/25 20:59:36 ross Exp $ */
+/*     $NetBSD: regular.c,v 1.8 2000/03/20 18:23:26 kleink Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)regular.c  8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: regular.c,v 1.7 1998/08/25 20:59:36 ross Exp $");
+__RCSID("$NetBSD: regular.c,v 1.8 2000/03/20 18:23:26 kleink Exp $");
 #endif
 #endif /* not lint */
 
@@ -79,11 +79,13 @@
                return (c_special(fd1, file1, skip1, fd2, file2, skip2));
 
        if ((p1 = (u_char *)mmap(NULL, (size_t)length,
-           PROT_READ, MAP_PRIVATE|MAP_FILE, fd1, skip1)) == (u_char *)-1)
+           PROT_READ, MAP_PRIVATE|MAP_FILE, fd1, skip1)) == MAP_FAILED)
                err(ERR_EXIT, "%s", file1);
+       (void)madvise(p1, (size_t)length, MADV_SEQUENTIAL);
        if ((p2 = (u_char *)mmap(NULL, (size_t)length,
-           PROT_READ, MAP_PRIVATE|MAP_FILE, fd2, skip2)) == (u_char *)-1)
+           PROT_READ, MAP_PRIVATE|MAP_FILE, fd2, skip2)) == MAP_FAILED)
                err(ERR_EXIT, "%s", file2);
+       (void)madvise(p2, (size_t)length, MADV_SEQUENTIAL);
 
        dfound = 0;
        for (byte = line = 1; length--; ++p1, ++p2, ++byte) {



Home | Main Index | Thread Index | Old Index