Commit 8dcf947d authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

mmap: Only use MAP_NOCACHE on platforms that support it.

That would be Darwin and some BSDs apparently
parent cbc1122a
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment