Re: cvs: php4 /ext/standard file.c

From: Date: Fri, 22 Dec 2000 17:11:36 +0000
Subject: Re: cvs: php4 /ext/standard file.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3230@lists.php.net to get a copy of this message
At 06:02 PM 12/22/00 +0100, Sascha Schumann wrote:
On Fri, 22 Dec 2000, Andi Gutmans wrote: As you're doing the write() in one go now and the file could be very big you're best off checking the return value on how much has been written and call write() as many times as needed. Less change that the 8K buffer will fail although it should also be done if mmap() isn't being used. Probably best if we have full_write() and full_read() API functions which do it for you and change most places to use these.
    Functions which are dealing with non-regular files might
    benefit of such an API.
    In this case though it does not matter, because we are
    dealing with regular files.  The only reason why write(2)
    could write less bytes than requested is the shortage of
    available space (i.e. limited through ulimit or physical
    storage limitations).  Trying to write more bytes in that
    case will get us a SIGXFSZ signal and probably terminate the
    process.  So, that is even more harmful than the current
    behaviour.
    A possible improvement in this case is checking the return
    value of write and setting ret only to SUCCESS, if the amount
    of written bytes equals the size of the source file.
I still think it could be beneficial. write() can theoretically also return with EINTR and although you say that it always manages to write to regular files I am not sure how all systems behave including OS and files systems such as NFS. It can't hurt to use a full_write()/full_read() in most places. Worst case it doesn't help. Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.cvs (#3230) next »