Follow-up on patch to ser-tcp.c

Mark Mitchell
2005-04-05T18:07:24Z

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

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.

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.

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.

I can drop (5) from the patch, and we can come back to that later.

With the set of changes described here, would you be willing to consider
the patch again? If so, I will post the modified version.

Thanks,

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304