www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/07/02/06:01:17

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_JS
X-Spam-Check-By: sourceware.org
Message-ID: <472084.52146.qm@web25505.mail.ukl.yahoo.com>
Date: Fri, 2 Jul 2010 10:01:02 +0000 (GMT)
From: Marco Atzeri <marco_atzeri AT yahoo DOT it>
Subject: R: getsockopt(SO_KEEPALIVE) returns incorrect option length
To: cygwin AT cygwin DOT com, Pavel Holejsovsky <pavel DOT holejsovsky AT upek DOT com>
In-Reply-To: <i0kb3m$r25$1@dough.gmane.org>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--- Ven 2/7/10, Pavel Holejsovsky ha scritto:

> Hi,
>=20
> I think that following problem shows problematic behavior
> in cygwin 1.7.5, at least incompatible with linux:
>=20
> #include <stdio.h>
> #include <sys/socket.h>
>=20
> int main() {
> =A0 =A0 =A0 =A0 int sock, option, optlen =3D
> sizeof(int);
> =A0 =A0 =A0 =A0 sock =3D socket(AF_INET,
> SOCK_STREAM, 0);
> =A0 =A0 =A0 =A0 getsockopt(sock, SOL_SOCKET,
> SO_KEEPALIVE, &option, &optlen);
> =A0 =A0 =A0 =A0 printf("option=3D%d,
> optlen=3D%d\n", option, optlen);
> =A0 =A0 =A0 =A0 return 0;
> }
>=20
> Prints optlen=3D1, while it is expected to be sizeof(int),
> i.e. 4.
>=20
> 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.
>=20
> This issue is relevant:
>=20
> SO_KEEPALIVE value is actually a char on Windows, not BOOL
> https://bugzilla.gnome.org/show_bug.cgi?id=3D611756
>=20
> And causes glib gio 2.24 to fail certain socket operations
> on cygwin.
>=20
> thanks,
> Pavel

option=3D0, optlen=3D4

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019