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: Change to Error logging routines.
Date Mon, 18 Oct 1999 15:53:24 GMT
On Mon, 18 Oct 1999 11:42:14 -0400 (EDT), Ryan Bloom wrote:

>I noticed late last week, that we are using errno in a lot of our error
>log messages.  This is not thread safe on most platforms, including
>Windows.  To avoid this, I am in the middle of making a change to the
>ap_log_error and ap_log_rerror calls.  Basically, we will have to pass a
>status value down to these functions, and that value will be used in place
>of errno.  This keeps our logs intelligable.  The only problem, is it
>breaks backwards compatability with older modules.  I don't see anyway
>around this.  This also solves the problem of APR functions not always
>setting errno.  If I can determine from internal values that an error
>condition can be returned, very often, I won't call the C RunTime function
>being asked for.  For example, I can determine quickly if a file is valid
>or not without needing the library to tell me so.
>
>Thoughts or objections.  I would like to commit this ASAP.

Wha? I though errno was thread safe on most platforms. I know it is on OS/2
and am fairly sure that any decent Windows compiler it is too. The usual
method used by compilers to make it thread safe is to #define errno to be a
function call that returns the appropriate value depending on the current
thread id. This is only enabled when compiling for a multithreaded target
though.

But as you say, the use of errno after an apr call is wrong as it isn't safe
to assume that apr calls will set errno.

-- 
 ______________________________________________________________________________
 |  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