httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject Re: Change to Error logging routines.
Date Thu, 21 Oct 1999 15:24:30 GMT

> In the OS/2 header files there's a constant ERROR_USER_DEFINED_BASE (set at
> 0xFF00) which all system error codes are less than. I'm not sure what you
> guys are getting at though, I can't see what use it would be for APR
> functions to return system error codes as nothing would understand them.

But, the goal is to have them understood.  Right now, we check for errors,
rather than checking for success.  We do that because in POSIX, checking
for errors is just easier.  With APR_SUCCESS, we can check for success in
all cases, and use portable API's to deal with the errors.

For example, this code should work regardless of what platform it's on.
(Assume valid types throught)

if ((status = ap_readdir(temp)) != APR_SUCCESS) {
    ap_log(APLOG_MARK, ... , status, ....);

In ap_log, we use the equivalent of strerror on all platforms to output a
meaningful error message.

There are places, where we actually need to know which error was returned
to do the right thing, but they are few and far between (I seem to
remember one in the old http_main.c), and these can be #ifdef'ed cleanly.

The most common uses for errno, was to see if there was a problem, and for
logging.  Both of those functions can be taken care of by APR.  I'm not
saying that we can get rid of all uses of platform specific error codes,
but we can get rid of a bunch of them.

Take a look at the new apr_errno.h, and see what you think.


Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message