httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: ap_status_t for Win32 (some conclusion finally?)
Date Sat, 01 Apr 2000 20:34:47 GMT
> >If I change the APR error definitions I posted earlier today so that
> >on Windows "return errno" works and that in macros we play some trick
> >on Windows like turn on bit 29 for native OS errors, does that meet
> >your approval? 
> I think this is more complex than is needed as it's platform
> specific.

The "trick" to turn on bit 29 is simply a special offset (0x20000000)
to add to OS errors on Win32 so that bit 29 is on.  All non-OS errors
on Win32 should have bit 29 off in our ap_status_t scheme*; thus our
offsets for other types of error codes will be smaller than 0x20000000 

(*this is the opposite of Microsoft's mapping, but we're smart enough
not to get confused)

> Some other platform may have actual error codes that have bit 29
> set.

not an issue at all...  we only have the bit 29 problem on Windows,
and it was already recognized that not all systems will have the same
values for the offset constants.  The bit 29 problem can be solved
simply by defining a special OS-error-offset-constant on Windows.

> Take a look at my proposed scheme and if you can find a significant
> disadvantage or deficiency in it then let us know. The way I've worked
> it, nothing needs to know about any bit mappings in Win32 error codes
> and should work in an identical way on all platforms. In fact it's so
> simple there must be _something_ wrong with it or we would have come up
> with it long ago (unless we're just slow that is ;-)

I just read it and I'm not sure exactly what you're alluding to.

If your proposed scheme is that the offset constants have the same
value on every platform, it is broken because different platforms have
different requirements.  In particular, for OS errors on Win32 we'll
flip on bit 29 by adding the magic constant.

If your proposed scheme allows different offset constants for
different platforms, then it seems like we're all talking about the
same thing with different names.

You called the constant AP_OSCODE_OFFSET and the macro AP_OS_STATUS().
I called the constant APR_OS_START_OSERR and the macro
APR_STATUS_FROM_OSERR().  This macro name came from Mr. Rowe.  The
constant name follows the pattern set in apr_errno.h long ago. 

Let me repost the code I showed this morning, but with the fix to
allow "return errno" to work on Win32.  Except for the system-specific
logic to define the offset constants, I think it is basically the same
as what you proposed.  There were some additional macros, however.

Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message