Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libprop Use posix_madvise() rather than the legac...



details:   https://anonhg.NetBSD.org/src/rev/4f490f5f6e48
branches:  trunk
changeset: 451152:4f490f5f6e48
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed May 08 04:34:33 2019 +0000

description:
Use posix_madvise() rather than the legacy madvise() call, and
wrapp the calls in #ifdef for the advice we're giving.  Should
address reports of host tool build issues.

diffstat:

 common/lib/libprop/prop_object.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 9ddbef272a11 -r 4f490f5f6e48 common/lib/libprop/prop_object.c
--- a/common/lib/libprop/prop_object.c  Wed May 08 03:29:59 2019 +0000
+++ b/common/lib/libprop/prop_object.c  Wed May 08 04:34:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: prop_object.c,v 1.30 2015/05/12 14:59:35 christos Exp $        */
+/*     $NetBSD: prop_object.c,v 1.31 2019/05/08 04:34:33 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -950,7 +950,10 @@
                _PROP_FREE(mf, M_TEMP);
                return (NULL);
        }
-       (void) madvise(mf->poimf_xml, mf->poimf_mapsize, MADV_SEQUENTIAL);
+#ifdef POSIX_MADV_SEQUENTIAL
+       (void) posix_madvise(mf->poimf_xml, mf->poimf_mapsize,
+           POSIX_MADV_SEQUENTIAL);
+#endif
 
        if (need_guard) {
                if (mmap(mf->poimf_xml + mf->poimf_mapsize,
@@ -976,7 +979,10 @@
     struct _prop_object_internalize_mapped_file *mf)
 {
 
-       (void) madvise(mf->poimf_xml, mf->poimf_mapsize, MADV_DONTNEED);
+#ifdef POSIX_MADV_DONTNEED
+       (void) posix_madvise(mf->poimf_xml, mf->poimf_mapsize,
+           POSIX_MADV_DONTNEED);
+#endif
        (void) munmap(mf->poimf_xml, mf->poimf_mapsize);
        _PROP_FREE(mf, M_TEMP);
 }



Home | Main Index | Thread Index | Old Index