From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Za8cJ-0008Ah-1f for qemu-devel@nongnu.org; Thu, 10 Sep 2015 16:38:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Za8cD-0000hF-27 for qemu-devel@nongnu.org; Thu, 10 Sep 2015 16:38:46 -0400 Received: from v220110690675601.yourvserver.net ([37.221.199.173]:35395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Za8cC-0000gh-Ri for qemu-devel@nongnu.org; Thu, 10 Sep 2015 16:38:40 -0400 Message-ID: <55F1EA4C.7020807@weilnetz.de> Date: Thu, 10 Sep 2015 22:38:36 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1438337876-13558-1-git-send-email-berrange@redhat.com> <55BB6EED.2010805@redhat.com> <55BBB755.1060503@weilnetz.de> <20150805095246.GB16246@redhat.com> <55C1ED97.2080005@weilnetz.de> <55C2064B.2050606@redhat.com> In-Reply-To: <55C2064B.2050606@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] QEMU 2.4 for Windows - current status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , "Daniel P. Berrange" Cc: qemu-devel@nongnu.org Am 05.08.2015 um 14:49 schrieb Paolo Bonzini: > On 05/08/2015 13:03, Stefan Weil wrote: [...] >> slirp: Fix non blocking connect for w32 >> http://repo.or.cz/w/qemu/ar7.git/commit/b3f21d56ad3f36562d396685de8ff4= 981af6b805 >=20 > The second looks good, but you do not need the #ifdef at all in theory. > If you do, other breakage is looming. >=20 > Paolo The new code was this: if ((tcp_fconnect(so) =3D=3D -1) && #if defined(_WIN32) socket_error() !=3D WSAEWOULDBLOCK #else (errno !=3D EINPROGRESS) && (errno !=3D EWOULDBLOCK) #endif ) { Without the preprocessor conditionals, Linux users would get an undefined WSAEWOULDBLOCK. And QEMU defines a macro EWOULDBLOCK which differs from the MinGW-w64 definition, at least in my Debian Jessie cross environment (10035 !=3D 140): include/sysemu/os-win32.h: # define EWOULDBLOCK WSAEWOULDBLOCK /usr/share/mingw-w64/include/pthread.h: #define EWOULDBLOCK 140 /usr/share/mingw-w64/include/psdk_inc/_wsa_errnos.h: #define WSAEWOULDBLOCK (WSABASEERR + 35 ) That's only a problem if we get pthread.h when compiling for Windows. Can we be sure that this won't happen? It looks like Windows + MinGW(-w64) is a moving target which is not so easy to handle. Maybe it would be better to change tcp_fconnect() to return an ANSI error code (with a conversion from Windows error codes in that function). Or we introduce a wrapper for connect(), qemu_connect(). Stefan