From b8b4694b33d516b0e017811bb8f9fe6b8533cd66 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 15 Feb 2015 05:42:18 +0100 Subject: [PATCH] portableproplib: use posix_madvise rather than madvise. The posix variant is the standardized version of madvise. --- lib/portableproplib/prop_object.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/portableproplib/prop_object.c b/lib/portableproplib/prop_object.c index dfa60fe5..3afb4d93 100644 --- a/lib/portableproplib/prop_object.c +++ b/lib/portableproplib/prop_object.c @@ -946,18 +946,18 @@ _prop_object_internalize_map_file(const char *fname) mf->poimf_xml = mmap(NULL, need_guard ? mf->poimf_mapsize + pgsize : mf->poimf_mapsize, - PROT_READ, MAP_FILE|MAP_SHARED, fd, (off_t)0); + PROT_READ, MAP_SHARED, fd, (off_t)0); (void) close(fd); if (mf->poimf_xml == MAP_FAILED) { _PROP_FREE(mf, M_TEMP); return (NULL); } - (void) madvise(mf->poimf_xml, mf->poimf_mapsize, MADV_SEQUENTIAL); + (void)posix_madvise(mf->poimf_xml, mf->poimf_mapsize, POSIX_MADV_SEQUENTIAL); if (need_guard) { if (mmap(mf->poimf_xml + mf->poimf_mapsize, pgsize, PROT_READ, - MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, + MAP_PRIVATE|MAP_FIXED, -1, (off_t)0) == MAP_FAILED) { (void) munmap(mf->poimf_xml, mf->poimf_mapsize); _PROP_FREE(mf, M_TEMP); @@ -978,8 +978,8 @@ _prop_object_internalize_unmap_file( struct _prop_object_internalize_mapped_file *mf) { - (void) madvise(mf->poimf_xml, mf->poimf_mapsize, MADV_DONTNEED); - (void) munmap(mf->poimf_xml, mf->poimf_mapsize); + (void)posix_madvise(mf->poimf_xml, mf->poimf_mapsize, POSIX_MADV_DONTNEED); + (void)munmap(mf->poimf_xml, mf->poimf_mapsize); _PROP_FREE(mf, M_TEMP); }