httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Havard" <bri...@kheldar.apana.org.au>
Subject Re: ap_status_t for Win32
Date Sat, 01 Apr 2000 06:37:58 GMT
On Fri, 31 Mar 2000 11:29:18 -0500 (EST), rbb@apache.org wrote:

>> Just an idea (feel free to shoot it down, I haven't thought about it
>> too hard), what if OS error codes were offset some fixed amount,
>> leaving 0->n for errno codes? The only exception being 0 stays 0 (which
>> == APR_SUCCESS). A macro for returning an OS error code could be:
>> 
>> AP_APRCODE_OFFSET 100  /* some room for APR defined codes */
>> AP_OSCODE_OFFSET  200
>> AP_OS_STATUS(oscode) (oscode ? oscode + AP_OSCODE_OFFSET : APR_SUCCESS)
>
>Can't all of this be done by just redefining the current APR_FOO macros in
>apr_errno.h by platform, and adding some for platforms that need it.  I
>was under the impression that was the goal when this code was originally
>committed.

As I understand it, the current scheme doesn't really work in that
errno values collide with OS error codes. 
EG, on OS/2 APR_ENOMEM == ENOMEM == 12

but in OS/2's codes

#define ERROR_INVALID_ACCESS    12


The advantages of my scheme are:
- It's simple (always a good thing :)
- It can be done exactly the same on all platforms.
- It allows using the default unix implementation on non-unix platforms
without having to use macro wrappers around errno. IE "return errno;"
can be used safely everywhere.

There should also be a public function to transform OS error codes to
errno type codes that can be used by the application iff it needs to
make a decision based on the particular error. It would be a 'do
nothing' macro on unix.

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Mime
View raw message