X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=1.5 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,SPF_HELO_PASS,TW_JS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Pavel Holejsovsky Subject: Re: R: getsockopt(SO_KEEPALIVE) returns incorrect option length Date: Fri, 02 Jul 2010 13:31:54 +0200 Lines: 53 Message-ID: References: <472084 DOT 52146 DOT qm AT web25505 DOT mail DOT ukl DOT yahoo DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 In-Reply-To: <472084.52146.qm@web25505.mail.ukl.yahoo.com> 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 On 7/2/2010 12:01 PM, Marco Atzeri wrote: > --- 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 >> #include >> >> 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 > 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 Pavel -- 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