Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35563 invoked from network); 30 Aug 2013 14:43:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Aug 2013 14:43:18 -0000 Authentication-Results: pb1.pair.com header.from=boite.pour.spam@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=boite.pour.spam@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.172 as permitted sender) X-PHP-List-Original-Sender: boite.pour.spam@gmail.com X-Host-Fingerprint: 74.125.82.172 mail-we0-f172.google.com Received: from [74.125.82.172] ([74.125.82.172:34575] helo=mail-we0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/80-32511-58FA0225 for ; Fri, 30 Aug 2013 10:43:18 -0400 Received: by mail-we0-f172.google.com with SMTP id n5so452968wev.17 for ; Fri, 30 Aug 2013 07:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=IJT0wBZlYGhXNhgoN6t7zlcjSIS1EhkEbAYiUlSBBt0=; b=E6bFF1jzc837FD3fy65d6Mzrr5TPoyGZvEEpQNN4DXDeqNQ57vpjhn39LQNfOpbmYo VP1vfHbDjCktbPsCU7Qkg6BqJxFDesRLzWeRbncA3GOyFPiU6EgyVh7zJi3sfkP2J4gQ YeNM2loXuSu48VXmHkYuOuDAnx7TRqNbkGRonw//CUxX/1ew7hVGGioCBdB2N1b+DB8F l1cZ4TMccJp/TgeTDZebrYGO8VVd7dSKbl9EkdnYmZ3ACokU2fDY6fuaAYuq45iphS+0 7CTGuRuZ2YKQFZB5PbkvA8JLknhWSGBHDKQkGmrI3OAfJptwpsabp6A9OW/5me3IZxfZ 8hfQ== MIME-Version: 1.0 X-Received: by 10.180.188.202 with SMTP id gc10mr2837044wic.3.1377873794370; Fri, 30 Aug 2013 07:43:14 -0700 (PDT) Received: by 10.194.25.201 with HTTP; Fri, 30 Aug 2013 07:43:14 -0700 (PDT) Date: Fri, 30 Aug 2013 16:43:14 +0200 Message-ID: To: internals@lists.php.net Content-Type: multipart/mixed; boundary=001a11c262ce0f151704e52b3ea4 Subject: [PATCH] LFS support for PHP 5.5.1 From: boite.pour.spam@gmail.com (X Ryl) --001a11c262ce0f151704e52b3ea4 Content-Type: multipart/alternative; boundary=001a11c262ce0f151104e52b3ea2 --001a11c262ce0f151104e52b3ea2 Content-Type: text/plain; charset=ISO-8859-1 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 --001a11c262ce0f151104e52b3ea2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,

=A0 Please find attached a patch fo= r adding large file size support to PHP 5.5.1.
Basically, it allo= ws 32 bits machine to address file larger than 4GB, get correct results whe= n 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 h= ave their size rounded, yet, reading and writing will work as expected sinc= e it's done in the PHP's binary.

The changes are:=A0
- Some size_t are changed= to off_t wherever required.
- The code with unique mmap now loop= s the mmap until the complete file/stream is done processing
- Fi= x for the mmap of a popen's pipe that can't work (unrelated, but ea= sy 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 t= hat 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&#= 39;t have any time left for maintaining this patch, but I'm sure this p= atch has a value. So, I deny any right on it and put it in public domain fo= r whoever wants to improve it, integrate it.=A0


Let me know your remarks.
Cyri= l
--001a11c262ce0f151104e52b3ea2-- --001a11c262ce0f151704e52b3ea4--