tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: APR/native errors with non-blocking I/O
Date Fri, 31 May 2013 21:04:56 GMT
Rainer,

On 5/31/13 4:35 PM, Rainer Jung wrote:
> On 31.05.2013 21:34, Mark Thomas wrote:
>> "Caldarale, Charles R" <Chuck.Caldarale@unisys.com> wrote:
>>
>>>> From: Mark Thomas [mailto:markt@apache.org] 
>>>> Subject: APR/native errors with non-blocking I/O
>>>
>>> Assuming these are negative errno values:
>>>
>>>> On OSX the error code is -32
>>>
>>> Broken pipe.
>>>
>>>> On Linux the error code is -104
>>>
>>> Connection reset by peer.
>>>
>>> Did the other end go away?
>>>
>>> Can you get a packet capture from both one end or the other?
>>
>> Thanks Chuck. Very helpful.
>>
>> The other end does hang up but it wasn't clear if that was the root cause or the
result. The client reports invalid chunked encoding. I'll look into the client code.
>>
>> Where might I find a list of these error codes. My Google fu let me down.
> 
> First: the real numbers are the positive ones, so multiply all with -1.
> 
> The errno numbers are defined in
> 
> /usr/include/errno.h
> 
> and
> 
> /usr/include/sys/errno.h
> 
> at least on Linux. Most of them are not standardized, so can vary by
> platform.
> 
> Then there's strerror(3C) and perror(3C) (so "man strerror", "man perror").
> 
> Example:
> 
> #include <stdio.h>
> #include <string.h>
> int main() {
>     int n;
>     while(1) {
>         printf("Enter errno: ");
>         scanf("%d", &n);
>         printf("Error string for errno %d is: %s\n",
>                n, strerror(n));
>     }
> }
> 
> Compile and have fun.
> 
> IMHO we don't have that in the code to output text instead of cryptic
> numbers because it isn't really available on all needed platforms. I
> could be wrong though.

From the (Mac OS) man page:
"The perror() and strerror() functions conform to ISO/IEC 9899:1999
(``ISO C99'')".

Can we bet on C99?

Or we could create a macro that uses strerror() when available or just
returns the error code as a string when not available.

-chris


Mime
View raw message