httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject Re: fprintf(stderr in Apache and APR.
Date Tue, 16 Nov 1999 14:04:23 GMT

> > 1)  Re-write all the apr functions to follow the return a defined status
> > code.
> Uh... could you rephrase (1) ? I'm not parsing it...

Sure.  In fact, I'm not sure I would understand it if I hadn't written it.

APR has a defined standard for function prototypes:

ap_status_t ap_foo(arg1, arg2, arg3, ...)

A lot of the functions in the lib directory were taken from Apache 1.3,
and so they don't follow this format.  We could just re-write all of the
functions to return meaningful error codes in the status field, instead of
an error message to stderr, and a generic error value.


> 4) have a platform-specific error reporting function.
>    On Win32: it goes to the event log and/or a log file
>    On *nix: it goes to stderr
> Where you can't return a status code, but must report an error and exit 
> (e.g. malloc failure), then you can use the system error function.

I think we should be returning a status code in ALL cases.  We just have
to return APR_ENOMEM.  This lets the app figure out what to do about the
failure.  There is no reason APR has to decide to exit just because there
is no more memory to allocate (The app probably should, but you never

APR can never output error messages to a log file, and my own opion is
that we shouldn't ever be outputting messages.  The C Run-Time doesn't
output error messages, and it isn't really up to a Run-Time library to
write logs.  We should just be reporting that there is a problem, and
leaving the function, IMO.

> Of course, the words "platform-specific" means that the function goes into
> APR :-) and that APR can use it when necessary.
> I also believe that you should add a similar function, but it would be
> used for debugging messages. On Win32, it would go to DebugString(), on
> *nix, it would go to stderr.

Debugging NEEDS to be added to Apache and most likely to APR as well.  It
will most likely not get into the code before the BETA, but hopefully we
can put it in before too many BETA's are released.

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