Re: Streams: Further considerations
| From: | Wez Furlong | Date: | Fri, 04 Oct 2002 23:43:38 +0000 |
| Subject: | Re: Streams: Further considerations | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-89038@lists.php.net to get a copy of this message | ||
On 04/10/02, "Sascha Schumann" <sascha@apache.org> wrote:
> 1. Use fgetc in stream_gets for stdio stream ops
> 2. Add file descriptor-based stream ops
> 3. Redirect _php_stream_fopen_from_file/pipe to new stream
> ops, if possible
So, if fileno() returns a valid fd, we will use only read(2)/write(2),
otherwise we will use fgetc()/fread()/fwrite().
The latter should be an extremely rare occurrence - should be for
fopencookied or gnu memory based IO streams.
> > The stdio buffering could be restored when the stream is cast
> > for use by third-party libraries.
>
> I'm not sure what you are referring to -- do these libraries
> make use of "FILE *" directly?
Potentially, yes. One of the features of streams is that it allows
an extension to access the underlying handle (fd, FILE * or whatever),
and (to a limited extent) is able to synthesize/emulate the handle.
The whole point is to allow the stream to be passed into libraries
such as PDF, GD and others where the API is designed for a particular
handle type.
--Wez.