httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: APR errno handling finished.
Date Thu, 06 Apr 2000 14:43:59 GMT
On Wed, 5 Apr 2000, Jeff Trawick wrote:

> > I didn't.  See my last response to Ben's complaint.  Instead of thinking
> > that ALL platforms use their own error values as the primary value, start
> > from the other direction.  ALL platforms use errno as their primary value.
> > You end up with Ben's proposal exactly.
> > 
> > Where doesn't this work?
> Who is Ben?  (Maybe I need to seek professional help.)

Sorry, that should have been Brian.

> When you say "primary value", do you mean the type of error indicator
> which can be returned directly (e.g., "return errno" or "return
> GetLastError()") or do you mean something else?

I mean the error indicator that can be returned directly.

> Your APRDesign text seems to say that on Windows APR functions can
> "return GetLastError()" and on UNIX APR functions can "return errno."

That's because Windows should be using GetLastError as it's primary error
value.  I have yet to see duplicated code between Windows and Unix.
Windows does have some functions returning errno, but none of them are
duplications of unix code.

Does this mean Windows can't use errno?  No, it just means Windows
shouldn't be using errno as it's first choice for a web server.  Windows
should be using native errors as it's primary error values, and errnos
only when it has to, IMHO.

> If anywhere in APR we have Windows code that does "return
> GetLastError()" or equivalent, then on Windows APR can never ever
> "return errno." 

And Windows never should almost never return errno.  Windows doesn't
duplicate ANY unix code, because the types are different between unix and
Win32.  In the few cases where Windows should be returning errno, it can,
it just needs to add an offset to it.

> If anywhere in APR we have OS/2 code that does "return os2_error" or
> equivalent, then it can never ever "return errno" for the same
> reason. 

There is no way around this, every platform will have to choose one error
value that it returns un-munged.  All other errno value it adds an offset

> We certainly won't be able to have code in APR which runs on more than
> just UNIX and which uses functions/kernel calls which set errno,
> unless of course you introduce yet more macros which such common code
> will use whenever they want to "return errno."

If your platform wants to use unix APR code, then your platform's primary
error value will have to be errno.  That's okay.  But we should allow for
platforms that don't want to use errno because they don't have a need to
share code with Unix.


Ryan Bloom               
406 29th St.
San Francisco, CA 94131

View raw message