This is the mail archive of the
cygwin
mailing list for the Cygwin project.
R: getsockopt(SO_KEEPALIVE) returns incorrect option length
- From: Marco Atzeri <marco_atzeri at yahoo dot it>
- To: cygwin at cygwin dot com, Pavel Holejsovsky <pavel dot holejsovsky at upek dot com>
- Date: Fri, 2 Jul 2010 10:01:02 +0000 (GMT)
- Subject: R: getsockopt(SO_KEEPALIVE) returns incorrect option length
--- Ven 2/7/10, Pavel Holejsovsky ha scritto:
> Hi,
>
> I think that following problem shows problematic behavior
> in cygwin 1.7.5, at least incompatible with linux:
>
> #include <stdio.h>
> #include <sys/socket.h>
>
> int main() {
> ? ? ? ? int sock, option, optlen =
> sizeof(int);
> ? ? ? ? sock = socket(AF_INET,
> SOCK_STREAM, 0);
> ? ? ? ? getsockopt(sock, SOL_SOCKET,
> SO_KEEPALIVE, &option, &optlen);
> ? ? ? ? printf("option=%d,
> 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
> https://bugzilla.gnome.org/show_bug.cgi?id=611756
>
> And causes glib gio 2.24 to fail certain socket operations
> on cygwin.
>
> thanks,
> Pavel
option=0, optlen=4
on XP-sp2, cygwin 1.7.5s(0.227/5/3) 20100628
MArco
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple