[zeromq-dev] patch: non-blocking tcp accept

Martin Sustrik sustrik at fastmq.com
Tue Apr 28 12:53:14 CEST 2009


>> The one thing I'm unsure of is EAGAIN/EWOULDBLOCK distinction. It seems
>> that both Linux and Win32 assign the same numeric value to both errors.
>> I am not sure of other platforms.
>>
>> POSIX says:
>>
>> [EAGAIN]
>>     Resource unavailable, try again (may be the same value as
>> [EWOULDBLOCK]).
>>
>> [EWOULDBLOCK]
>>     Operation would block (may be the same value as [EAGAIN]).
>>
>> Pretty confusing...
> 
> from /usr/include/errno.h on AIX 5.3 ...
> 
> /* non-blocking and interrupt i/o */
> /*
>  * AIX returns EAGAIN where 4.3BSD used EWOULDBLOCK;
>  * but, the standards insist on unique errno values for each errno.
>  * A unique value is reserved for users that want to code case
>  * statements for systems that return either EAGAIN or EWOULDBLOCK.
>  */
> #if _XOPEN_SOURCE_EXTENDED==1
> #define EWOULDBLOCK     EAGAIN   /* Operation would block       */
> #else /* _XOPEN_SOURCE_EXTENDED */
> #define EWOULDBLOCK     54
> #endif /* _XOPEN_SOURCE_EXTENDED */
> 
> Might help de-confuse?

Oh my. It's even worse then I've expected :) The actual values may 
change depending on macros defined.

I've checked Solaris in the meantime - same value for both errors.

Anyway, it seems that checking for both errors everywhere we are 
checking for one of the two at the moment would yield a sane result.

Martin



More information about the zeromq-dev mailing list