iliaa           Mon Nov 15 18:43:13 2004 EDT

  Modified files:              
    /php-src/main       php_streams.h 
    /php-src/main/streams       streams.c 
  Log:
  Fixed bug #29801 (Set limit on the size of mmapable data).
  
  
http://cvs.php.net/diff.php/php-src/main/php_streams.h?r1=1.98&r2=1.99&ty=u
Index: php-src/main/php_streams.h
diff -u php-src/main/php_streams.h:1.98 php-src/main/php_streams.h:1.99
--- php-src/main/php_streams.h:1.98     Wed Sep 29 06:54:56 2004
+++ php-src/main/php_streams.h  Mon Nov 15 18:43:12 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_streams.h,v 1.98 2004/09/29 10:54:56 hyanantha Exp $ */
+/* $Id: php_streams.h,v 1.99 2004/11/15 23:43:12 iliaa Exp $ */
 
 #ifndef PHP_STREAMS_H
 #define PHP_STREAMS_H
@@ -407,8 +407,11 @@
 #define PHP_STREAM_OPTION_RETURN_NOTIMPL       -2 /* underlying stream does 
not implement; streams can handle it instead */
 
 /* copy up to maxlen bytes from src to dest.  If maxlen is 
PHP_STREAM_COPY_ALL, copy until eof(src).
- * Uses mmap if the src is a plain file and at offset 0 */
-#define PHP_STREAM_COPY_ALL            -1
+ * Uses mmap if the src is a plain file and at offset 0 
+ * To ensure we don't take up too much memory when reading large files, set 
the default mmap length
+ * at this many bytes */
+#define PHP_STREAM_COPY_ALL            2000000
+
 BEGIN_EXTERN_C()
 PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, 
size_t maxlen STREAMS_DC TSRMLS_DC);
 #define php_stream_copy_to_stream(src, dest, maxlen)   
_php_stream_copy_to_stream((src), (dest), (maxlen) STREAMS_CC TSRMLS_CC)
http://cvs.php.net/diff.php/php-src/main/streams/streams.c?r1=1.69&r2=1.70&ty=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.69 php-src/main/streams/streams.c:1.70
--- php-src/main/streams/streams.c:1.69 Thu Nov 11 08:08:32 2004
+++ php-src/main/streams/streams.c      Mon Nov 15 18:43:12 2004
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.69 2004/11/11 13:08:32 rrichards Exp $ */
+/* $Id: streams.c,v 1.70 2004/11/15 23:43:12 iliaa Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1162,7 +1162,7 @@
                char *p;
                size_t mapped;
 
-               p = php_stream_mmap_range(stream, php_stream_tell(stream), 0, 
PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
+               p = php_stream_mmap_range(stream, php_stream_tell(stream), 
PHP_STREAM_COPY_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
 
                if (p) {
                        PHPWRITE(p, mapped);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to