Re: ftell Issue or Feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Assuming each thread has its own copy of $this->fp, even after renaming the
> log file all other threads will still be pointing at the old file. The
> resource is connected to the inode, not the filename, so even if the
> filename changes the inode does not, therefore the actual location on disk
> represented by the resource does not.

Actually I thought pretty similar before. I will test the option below too

thanks!

> I would fix this by doing the following after acquiring the lock...
> 1. Close the file
> 2. Reopen the file
> 3. Seek to the end
> 4. Then do the ftell
> Alternatively it could just do a filesize on the filename to get the current
> size rather than using ftell on the resource. If the size is less than ftell
> then another thread has rolled it over and this thread needs to close and
> reopen the file. If they match, roll the file over.
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/



-- 
http://www.grobmeier.de

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux