From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: mark@codesourcery.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: PATCH: Windows sockets
Date: Sat, 26 Mar 2005 08:47:00 -0000 [thread overview]
Message-ID: <200503260845.j2Q8jlLC019248@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <200503260127.j2Q1R59a022152@sethra.codesourcery.com> (message from Mark Mitchell on Fri, 25 Mar 2005 17:27:05 -0800)
Date: Fri, 25 Mar 2005 17:27:05 -0800
From: Mark Mitchell <mark@codesourcery.com>
Here's the first "interesting" patch for Windows support. This patch
modifies ser-tcp.c to support Windows, so that we can use a GDB
running on Windows to talk to a gdbserver process.
Yikes. This is real ugly and I'm not too happy about this.
Here is a sumary of the changes in this patch:
1. Link with -lws2_32 on MinGW so we can use sockets.
Can't you just use a standard autoconf check to check for that library
instead of hardcoding it to be linked in on MinGW?
2. In defs.h, define WINAPI so that source files know whether they are
supposed to use the Windows API.
This is bad. Yet another #ifdef WINDHOOS when we really are trying to
get rid of those.
3. Move ser_unix_readchar and friends (which were only barely
UNIX-specific) into ser-base.c, renaming appropriately.
Fair enough.
4. Add a new member (read_prim) to struct serial_ops, and use it from
ser_base_readchar. The reason for this is that sockets must be
read with "recv" on Windows; plain "read" does not work. So, we
need a way to indicate which low-level primitive to use to read
from a file descriptor.
But write(2) does work and you don't need to use send(2). Oh you do
but things are not quite symmetric. Could you fix that? Isn't it a
better idea to change the #ifdef WINAPI in a #ifdef HAVE_RECV, add an
autoconf check for recv(2), and always prefer it over read(2) if
available for reading from a socket?
5. Make a handful of minor changes to ter-tcp.c to account for
differences in the BSD and Windows sockets APIs.
You mean that Windows doesn't have the proper BSD socket API even
though Microsoft stole^Wused the BSD TCP stack?
I really think these changes are too pervasive and that you really
need to create a ser-win32.c that has all the Windows-specific cruft
in it.
6. Tweak safe_strerror to deal with Windows sockets error codes.
I'm defenitely not thrilled by this tweak. You're only changing
"undocumented" into "winsock". I presume it helps with debugging this
stuff, but is it really worth the clutter it adds?
Sorry,
Mark
next prev parent reply other threads:[~2005-03-26 8:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-26 1:27 Mark Mitchell
2005-03-26 2:09 ` Christopher Faylor
2005-03-26 8:47 ` Mark Kettenis [this message]
2005-03-26 17:38 ` Mark Mitchell
2005-03-26 17:48 ` Christopher Faylor
2005-03-26 19:06 ` Mark Mitchell
2005-03-26 21:03 ` Christopher Faylor
2005-03-26 22:00 ` Eli Zaretskii
2005-03-27 12:59 ` Kai Henningsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200503260845.j2Q8jlLC019248@elgar.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sources.redhat.com \
--cc=mark@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox