Follow-up on patch to ser-tcp.c

Mark Mitchell mark@codesourcery.com
Wed Apr 6 17:52:00 GMT 2005


Mark Kettenis wrote:
>    Date: Tue, 05 Apr 2005 11:05:24 -0700
>    From: Mark Mitchell <mark@codesourcery.com>
> 
>    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.

I meant no criticism; I very much appreciate your help.

> 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.

OK; I've implemented that.

> 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.

It's possible to "#define ioctl ioctlsocket" so that ioctl doesn't need 
to change.  However, I think it would be very confusing to do "#define 
close closesocket" because there's already a Windows runtime library 
function called "close" -- it just doesn't work on sockets.  So, in the 
version of the patch that's attached, we still do have a call to 
closesocket.

Here's the revised version.

One note: you might wonder why ser-base.c #include's <winsock2.h>.  The 
reason is that ser-base.c uses select, and struct timeval comes form 
that header on Windows.  We may eventually have to use something other 
than select on Windows, but we don't yet.

Is this version OK?

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gdb.ser.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20050406/e5b5555a/attachment.ksh>


More information about the Gdb-patches mailing list