httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@lnd.com>
Subject RE: ap_status_t for Win32
Date Thu, 30 Mar 2000 17:24:26 GMT
> Only one small part of ap_strerror() is not portable: the mechanism
> for retrieving the description of an OS-specific error.
> 
> Summary of portability:
> 
>   portable parts of the ap_strerror()
> 
>   . code to identify that error is errno
>   . code to grab description for an errno
>   . code to identify that error is APR error/status code
>   . code to grab description for an APR error/status code

Correct, all portable.

>   . code to identify that error is OS-specific error code

Not portable, but what if you do this in apr_win.h (and on
those platforms that need it, in their apr.h autoconf target):

#define HAVE_OSERROR

and in apr_error.h:

#ifdef HAVE_OSERROR
ap_status_t ap_str_oserror(ap_status_t erno, char * errmsg [...]);
#endif

and in lib/apr_strerror.c - add to ap_strerror()

#ifdef HAVE_OSERROR
    else if (APR_IS_OSERROR(erno)
    {
        stat = ap_str_oserror(erno, msg, [...]);
        if (stat)
             ap_strcat(msg, "Unknown system error ", ernostr [...])
    }
#endif

and in misc/os/errors.c declare ap_str_oserror().

that's some real rough metacode, but it is cross platform.  I believe
noone wants to see the laundry list if #if OS in our xplat apr!

>   . code to handle other types of error codes

Portable?  This should return an error code itself that no 
message was available.
 
>   non-portable parts of ap_strerror()
> 
>   . code to grab description for an OS-specific error code
> 
> Clearly, ap_strerror() is largely (85%?) portable.  It just needs a
> service routine implemented for each platform to retrieve the
> description for an OS-specific error code.

Sold.
 
> The implementations of the macros to manipulate ap_status_t are
> definitely unique to each OS, but that is outside of the scope of
> ap_strerror(). 

Right, I believe apr.h or apr_config.h is the right place for that.

> -- 
> Jeff Trawick | trawick@ibm.net | PGP public key at web site:
>      http://www.geocities.com/SiliconValley/Park/9289/
>           Born in Roswell... married an alien...
> 

Mime
View raw message