Re: ftell Issue or Feature
| From: | Christian Grobmeier | Date: | Wed, 08 Jun 2011 10:00:27 +0000 |
| Subject: | Re: ftell Issue or Feature | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313466@lists.php.net to get a copy of this message | ||
> 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