httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <stodd...@raleigh.ibm.com>
Subject Re: APR_EOF?
Date Thu, 22 Jun 2000 18:12:59 GMT
Forget for now my speculation that maybe we could combine sockets with pipe/file i/o. Just
focus on sharing pipe/file code between platforms.

> > On a related topic, is there any reason why we can't consolidate the
> > ap_read code across platforms? ap_read must:
> >
> > 1. handle the ungetchar
> > 2. handle reads (non-blocking, non-blocking with timeouts and blocking)
> > 3. buffered i/o
> > 4. 1 thru 3 for both files and pipes
> >
> > Most of this code is identical across Unix and Windows which implies
> > we should create a common ap_read() implementation which calls a
> > platform specific os_read_with_timeout(). os_read_with_timeout() is
> > where the platform specific code resides. os_read_with_timeout() would
> > need to know if it is handling a pipe or a file.  Right now, each
> > platform is handling the ungetchar, buffered reads, etc. differently,
> > which is not good.
>
> I just looked at the ap_read code.  Most of it is not common across
> platforms.

Indeed. ap_read() semantics are different for each platform, which is precisely the
problem.

> One of the reasons that we have re-written this code, is so
> that Windows can use their native functions.

os_read_with_timeout() implements the lowlevel platform specific read with timeout. All
very platform specific.  The code to handle ungetchar, i/o buffering, etc can all be
identical. Watch what I do with ap_read on Windows in the next week or so (it doesn't do
timeout now). The only crufty thing that comes to mind is the implementation of ap_file_t.
Yes, it would need to include #ifdef YOUR_PLATFORM whatnot. This may be a worthwhile
tradeoff in certain circumstances if it helps keep APR semantics the same across multiple
implementations. Right now it's all over the floor.

Bill




Mime
View raw message