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 Subject: R: getsockopt(SO_KEEPALIVE) returns incorrect option length To: cygwin AT cygwin DOT com, Pavel Holejsovsky In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 > #include >=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