httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject error codes again... (was: cvs commit: ... errorcodes.c)
Date Thu, 20 Apr 2000 22:49:52 GMT
On Thu, 20 Apr 2000 rbb@covalent.net wrote:
> > You are right, I did miss this.  But I'm not sure it this is the best design choice.
I'll
> > give it some more thought (or you can enlighten me :-)
> 
> We really want to share code, but I'm not sure this is a big issue for
> Windows.  Perhaps if we just document the hell out of the fact that
> Windows has it's error codes reversed (native returned un-munged, errno
> returned munged).  As long as it is well documented with HUGE neon pink 
> arrows and we NEVER want to share Windows code, I have no problem swapping
> error codes on some platforms.

I think you're making it more difficult than it needs to be. You're also
trying to impose a condition that does not need to be imposed.

*) Unix, BeOS, and OS/2 can all define their primary errors to be errno.
*) Windows (and Novell?) can define it to be GetLastError()

NOBODY is going to care what number is returned by APR. It can be
anything, in any kind of range, with any kind of meaning. There are three
things that are done with the return value:

1) compare against APR_SUCCESS
2) pass to ap_strerror()
3) pass to ap_canonical_err()

None of those require any particular meaning to the number. All semantics
attached to the error number are internalized by APR.


Get off this restriction about "MUST BE ERRNO". If a platform wants to
share code, then yes: they must share error patterns. But from an API
point of view, there is absolutely no reason to mandate errno.

The errors from ap_canonical_err() can actually be in an entirely new
numeric space. The canonical errors are DISJOINT from the APR functions'
return values.

This allows the Win32 APR code to simply do GetLastError(). Unix code can
return errno. OS/2 and BeOS can share the Unix code, which implies they
share "errno" as their primary returns. These latter two platforms will
need a range that is disjoint from errno, so they can return platform-
specific errors, but that has already been solved (by virtue of errno
having a finite range).

I am happy to write up a patch to the APRDesign document. I've avoided
most of this back and forth over the error handling, but it has generated
a LOT of traffic. I'm happy to help just to trim back the spammage :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/


Mime
View raw message