From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32175 invoked by alias); 6 Apr 2005 07:41:23 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 32080 invoked from network); 6 Apr 2005 07:41:15 -0000 Received: from unknown (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org with SMTP; 6 Apr 2005 07:41:15 -0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j367dqX4007470; Wed, 6 Apr 2005 09:39:52 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.3/8.13.3) with ESMTP id j367dp0j008702; Wed, 6 Apr 2005 09:39:51 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.3/8.13.3/Submit) id j367dlM3000821; Wed, 6 Apr 2005 09:39:47 +0200 (CEST) Date: Wed, 06 Apr 2005 07:41:00 -0000 Message-Id: <200504060739.j367dlM3000821@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: mark@codesourcery.com CC: gdb-patches@sources.redhat.com In-reply-to: <4252D364.7050304@codesourcery.com> (message from Mark Mitchell on Tue, 05 Apr 2005 11:05:24 -0700) Subject: Re: Follow-up on patch to ser-tcp.c References: <4252D364.7050304@codesourcery.com> X-SW-Source: 2005-04/txt/msg00052.txt.bz2 Date: Tue, 05 Apr 2005 11:05:24 -0700 From: Mark Mitchell Mark -- A while back, I posted a patch to change ser-tcp.c to support Windows, here: http://sources.redhat.com/ml/gdb-patches/2005-03/msg00331.html Apologies for not getting back to you. You had some objections: 1. The configury change to link with -lws2_23 on Windows. 2. The use of #ifdef WINAPI. 3. The asymmetry I introduced by adding the "read_prim" member to "struct serial" without a corresponding "write_prim" member. 4. Changes to support differences between BSD and Windows socket APIs. 5. Modifications to strerror. I don't see a way around (1). The question is really not whether the library is available; the question is whether we should use it. On MinGW, we should; on Cygwin, we should not. Not happy with it, but I suppose you're right. But please read on. The impact of (2) can be mitigated by using __MINGW32__ instead of WINAPI. That will avoid the defs.h change, and localize the changes to the actual conditional code. Actually I think the WINAPI thingy is more descriptive. In light of the discussion above, I think there should be a single spot in configure.ac where we decide whether we want to use the native Windows API or the proper POSIX interfaces that Cygwin provides get used. Some sort of "Windows but not Cygwin" would than add -lws2_23 and define something like USE_WIN32API, and we'd use that define everywhere where there is a choice between the native Windows API and the proper POSIX interfaces. In my local version of the patch, I've corrected (3); the symmetry is now complete. I've also mitigated (4), in that I've determined that send/recv should work fine on all targets. That means that we don't need an #ifdef to decide whether to use "read" or "recv"; we can just always use "recv", as that function is available both on Windows and elsewhere. Great! In this area we also have the ioctlsock v.s. ioctl issue. Is it possible to keep using the proper POSIX interfaces in the code and #define ioctl ioctlsock in the USE_WIN32API case instead of the other way around? I think that makes it easier for non-Windows programmers to understand the code. I can drop (5) from the patch, and we can come back to that later. That'd be a good idea. I get the feeling that errno values and Windows OS errors are fundamentally different things. Perhaps the best way to solve this would be to translate the Windows OS errors into the appropriate errno value ate the appropriate place. With the set of changes described here, would you be willing to consider the patch again? If so, I will post the modified version. Please do so. Mark