[vlc-devel] commit: mmap: Correct [cbc1122ac4551505181ea048ca14a5f87041090f] ( Derk-Jan Hartman )

git version control git at videolan.org
Fri Oct 10 14:57:32 CEST 2008


vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Fri Oct 10 14:55:49 2008 +0200| [34aef4ada6758f39d5af2300b1ac74acdc0b567c] | committer: Derk-Jan Hartman 

mmap: Correct [cbc1122ac4551505181ea048ca14a5f87041090f]

I accidently change the probe, not the actual mmap() usage.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=34aef4ada6758f39d5af2300b1ac74acdc0b567c
---

 modules/access/mmap.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/access/mmap.c b/modules/access/mmap.c
index bce52f5..eb551ab 100644
--- a/modules/access/mmap.c
+++ b/modules/access/mmap.c
@@ -136,12 +136,7 @@ static int Open (vlc_object_t *p_this)
     /* Autodetect mmap() support */
     if (st.st_size > 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);
+        void *addr = mmap (NULL, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
         if (addr != MAP_FAILED)
             munmap (addr, 1);
         else
@@ -225,8 +220,11 @@ static block_t *Block (access_t *p_access)
     /* NOTE: We use PROT_WRITE and MAP_PRIVATE so that the block can be
      * modified down the chain, without messing up with the underlying
      * original file. This does NOT need open write permission. */
-    void *addr = mmap (NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE,
-                       p_sys->fd, outer_offset);
+    void *addr = mmap (NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE
+#ifdef MAP_NO_CACHE
+                       | MAP_NOCACHE
+#endif
+                       , p_sys->fd, outer_offset);
     if (addr == MAP_FAILED)
     {
         msg_Err (p_access, "memory mapping failed (%m)");




More information about the vlc-devel mailing list