[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-devel
Subject:    Re: [xine-devel] [patch] Nasty mmap problem with huge files
From:       Andrew de Quincey <adq () lidskialf ! net>
Date:       2007-06-02 18:07:50
Message-ID: 20070602190750.lta75thdwgs4s04w () lidskialf ! net
[Download RAW message or body]

This message is in MIME format.


Oops sorry, slight typo in my original patch preventing compilation;  
update attached.


["xine-1.1.6-mmap-2.patch" (text/x-diff)]

diff -Naur xine-lib-1.1.6.ORIG/src/input/input_file.c xine-lib-1.1.6.PATCHING/src/input/input_file.c
--- xine-lib-1.1.6.ORIG/src/input/input_file.c	2007-04-17 02:00:50.000000000 +0100
+++ xine-lib-1.1.6.PATCHING/src/input/input_file.c	2007-06-02 18:33:11.507876845 +0100
@@ -359,6 +359,9 @@
   file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
   char                *filename;
   struct stat          sbuf;
+#ifdef HAVE_MMAP
+  size_t	       tmp_size;
+#endif
 
   lprintf("file_plugin_open\n");
 
@@ -423,10 +426,14 @@
   }
 
 #ifdef HAVE_MMAP
-  if ( (this->mmap_base = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, this->fh, 0)) != (void*)-1 ) {
+  tmp_size = sbuf.st_size;
+  if ((tmp_size == sbuf.st_size) &&
+      ( (this->mmap_base = mmap(NULL, tmp_size, PROT_READ, MAP_SHARED, this->fh, 0)) != (void*)-1 )) {
     this->mmap_on = 1;
     this->mmap_curr = this->mmap_base;
     this->mmap_len = sbuf.st_size;
+  } else {
+    this->mmap_base = NULL;
   }
 #endif
 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
xine-devel mailing list
xine-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic