[vlc-devel] commit: mmap: Only use MAP_NOCACHE on platforms that support it. ( Derk-Jan Hartman )
git version control
git at videolan.org
Fri Oct 10 14:16:31 CEST 2008
vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Fri Oct 10 14:15:37 2008 +0200| [8dcf947d585d89db6e6b879cc4699d7ca60bb5e4] | committer: Derk-Jan Hartman
mmap: Only use MAP_NOCACHE on platforms that support it.
That would be Darwin and some BSDs apparently
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8dcf947d585d89db6e6b879cc4699d7ca60bb5e4
---
modules/access/mmap.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/modules/access/mmap.c b/modules/access/mmap.c
index a5aefd4..bce52f5 100644
--- a/modules/access/mmap.c
+++ b/modules/access/mmap.c
@@ -136,7 +136,12 @@ static int Open (vlc_object_t *p_this)
/* Autodetect mmap() support */
if (st.st_size > 0)
{
- void *addr = mmap (NULL, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_NOCACHE, fd, 0);
+ int flags = MAP_PRIVATE;
+#if defined(MAP_NOCACHE)
+ flags |= MAP_NOCACHE;
+#endif
+
+ void *addr = mmap (NULL, 1, PROT_READ|PROT_WRITE, flags, fd, 0);
if (addr != MAP_FAILED)
munmap (addr, 1);
else
More information about the vlc-devel
mailing list