Hi,

  Please find attached a patch for adding large file size support to PHP
5.5.1.
Basically, it allows 32 bits machine to address file larger than 4GB, get
correct results when asking for their size, allows to read and write them,
etc...

It does so by, from the PHP's side, getting double instead of int for the
file size/ offset functions, when the size is larger than 2^31.

This means that files with size:
- up to 2^32 bytes works as previously (integer returned / used)
- up to 2^52 bytes can be handled correctly (double's mantissa is 52 bits,
no loss in precision here)
- from 2^52 up to 2^64 will have their size rounded, yet, reading and
writing will work as expected since it's done in the PHP's binary.

The changes are:
- Some size_t are changed to off_t wherever required.
- The code with unique mmap now loops the mmap until the complete
file/stream is done processing
- Fix for the mmap of a popen's pipe that can't work (unrelated, but easy
to fix while working on the mmap code)
- Change the return type based on the actual range of the manipulated
number (so if the value fit in a integer, a integer is used, and the code
that used to work still works, but if it does not fit, a double is used,
and the code that used to fails now works)

Please notice that I'm not a PHP developer, I don't have any time left for
maintaining this patch, but I'm sure this patch has a value. So, I deny any
right on it and put it in public domain for whoever wants to improve it,
integrate it.


Let me know your remarks.
Cyril
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to