[erlang-patches] Montavista system call error handling patch
Björn Gustavsson
bgustavsson@REDACTED
Wed May 19 08:49:21 CEST 2010
2010/5/18 Steve Vinoski <vinoski@REDACTED>:
> 2010/5/18 Björn Gustavsson <bgustavsson@REDACTED>:
>> The build problem exposes a place where the new IS_SOCKET_ERROR()
>> macro is not used.
>>
>> Another thing is that the Windows version of the macro should still
>> use SOCKET_ERROR:
>>
>> #define IS_SOCKET_ERROR(val) ((val) == SOCKET_ERROR)
>>
>> since SOCKET_ERROR is defined in a header file on Windows.
>>
>> Because of the build error, Raimo has taken out the branch
>> from the pu branch. He will re-instate it as soon as you have
>> fixed the build problem.
>
> Sorry about that, I messed it up when I removed SOCKET_ERROR as you
> had suggested. I've restored SOCKET_ERROR since it's still used in the
> Windows code, and found and fixed the one place that needed the new
> IS_SOCKET_ERROR macro but wasn't using it. It all builds correctly
> again.
Thanks!
SOCKET_ERROR really must be defined, but the reason
why it must be defined is that the value of SOCKET_ERROR
is returned from the functions erts_sock_send() and
erts_sock_gethostname() at the end of the file. On Windows,
SOCKET_ERROR is defined in the winsock2.h header file.
One more change is necessary to get it build on Windows.
The macro definition for IS_SOCKET_ERROR() is inside
the #else part of a huge #ifdef and will only be defined on
Unix systems. It must be moved like this:
http://github.com/bjorng/otp/commit/6fc366caffca7a6cf9c5aff084d169da18ca9efa
(That commit should be combined with the previous
commit before including the branch in pu.)
Since the #ifdef structure is complicated in the inet_drv.c, I suggest
that a red herring (that fooled me for a while) should be eliminated:
http://github.com/bjorng/otp/commit/fcc0f94ef1831751cf8ae8be209a5cb0f442854f
My updated version of the branch can be found here:
git fetch git://github.com/bjorng/otp.git sv/socket-error-portability
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-patches
mailing list