httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject RE: cvs commit: apache-2.0/src/lib/apr/network_io/os2 os2nerrno.h os2calls.h
Date Mon, 09 Oct 2000 15:11:36 GMT
> They may be macros or functions, depending.  I'd guess:
> >
> >   #define apr_get_os_error()    (errno)
> >   #define apr_set_os_error(e)   (errno = (e))
> >   #define apr_get_netos_error() (APR_FROM_OS_ERROR(sock_errno()))
> >
> >would be appropriate for OS2?
> 
> There is no equivalent. All OS/2 API calls return their error codes
> directly, there's no global variable that holds the last error code (the
> socket functions are an exception to this rule as they're a direct port
> from BSD). I personally see such globals as bad and I don't think I'm alone
> in that which is why APR works in the same way as OS/2 API calls. Every
> apr_* function returns its error code directly.

After I wrote that message... I spent some time in the OS2 tree (and fell in
the TPF tree as well.)  And after thinking about this...

No later than Release Candidiate 1 (post beta) - these macros should become 
apr internal handlers.  Client code (Apache) should not be playing with the 
errno it doesn't understand.  This might not be realistic for the MPM's if
they can't (shouldn't) be apr-ized.  But good design says that APR -already- 
created all the errors, not Apache.  And if they aren't used, they can be
dumped.

As far as the OS/2 flavors of apr_get_os_error() and apr_set_os_error(), 
this would be fun:

#define apr_get_os_error()    (\
#error Fatal assumption in __LINE__ of __FILE__, that we support apr_get_os_error\
}

But I doubt it would compile the way I expect.

> >Of course you can suggest I'm out of my mind trying to
> >introduce this sort of portability.
> 
> I wouldn't go that far :) but I don't understand what you're trying to
> achieve.
> 
> If you're wanting to be able to use the generic unix code on Win32 I think
> these macros aren't necessary. The problem there was the incompatible error
> code mapping which I think you've already fixed. It might help if you post
> a patch showing what you intend to do to the unix code. 

I was trying to distill errno / APR_FROM_OS_ERROR(WSAGetLastError()) and, I
suppose, APR_OS2_ERROR(sock_error()) into a single readable format.  It may
never be used on unix and could be deleted soon at the end of the alpha
series, this just assured I could build upon some ideas.  Right now the only
applications of apr_xxxos_error are within src/lib/apr/xxx/win32/, 
src/modules/mpm/winnt and src/os/mod_isapi.c  That may not change at all,
and these symbols can then go away.  But we have many errno symbols throughout
Apache, and these hurt OS2 as well as Win32.




Mime
View raw message