This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: R: getsockopt(SO_KEEPALIVE) returns incorrect option length

On 7/2/2010 12:01 PM, Marco Atzeri wrote:
--- Ven 2/7/10, Pavel Holejsovsky ha scritto:


I think that following problem shows problematic behavior
in cygwin 1.7.5, at least incompatible with linux:


int main() {
         int sock, option, optlen =
         sock = socket(AF_INET,
         getsockopt(sock, SOL_SOCKET,
optlen=%d\n", option, optlen);
         return 0;

Prints optlen=1, while it is expected to be sizeof(int),
i.e. 4.

This is most probably because uinderlying winsock call has
this (mis)behavior, but I think that in cygwin layer this
could be worked around to be more unix compatible.

This issue is relevant:

SO_KEEPALIVE value is actually a char on Windows, not BOOL

And causes glib gio 2.24 to fail certain socket operations
on cygwin.


option=0, optlen=4

on XP-sp2, cygwin 1.7.5s(0.227/5/3) 20100628

Thanks for testing, Marco.

So it is even system-dependent misbehaviour of winsock. On w7-x64 cygwin 1.7.5 it prints
option=2674688, optlen=1


-- Problem reports: FAQ: Documentation: Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]