Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC 00/17] Merge event loop implementations
Date: Tue, 26 Feb 2019 16:04:00 -0000	[thread overview]
Message-ID: <83y362lenr.fsf@gnu.org> (raw)
In-Reply-To: <87o96ztwpa.fsf@tromey.com> (message from Tom Tromey on Mon, 25	Feb 2019 13:55:13 -0700)

> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
> Date: Mon, 25 Feb 2019 13:55:13 -0700
> 
> Eli> Can you point me to the gdbserver code which calls 'socket' and
> Eli> 'accept' on Windows, whose results are used in 'select'?  I'd like to
> Eli> see what it does on Windows, to be able to have a better idea of what
> Eli> adaptations would be necessary for Gnulib's 'select'.
> 
> Everything is in gdb/gdbserver/remote-utils.c.  Search for the calls to
> add_file_handler.
> 
> handle_accept_event calls accept, sets remote_desc, then calls
> add_file_handler for it.

Thanks.  It sounds like most of the adaptation is to use Gnulib's
replacements for these functions, and remove most or all of the
USE_WIN32API ifdef's.

> remote_open does the other call.  It is maybe less than obvious but this
> code rules out the use of stdin on windows:
> 
>     #ifdef USE_WIN32API
>       if (port_str == NULL)
>         error ("Only HOST:PORT is supported on this platform.");
>     #endif
> 
> So, the STDIO_CONNECTION_NAME branch cannot be taken; the others are
> #if'd out; leaving just the final one that calls add_file_handler on
> listen_desc.  listen_desc is actually created in remote_prepare.

I guess stdin is disabled because 'select' doesn't support it.  But
with Gnulib, we could allow that, although perhaps not in the initial
phase of the changes.

> Eli> Offhand, I think we'd need just the trivial adaptations, like make
> Eli> sure gdbserver uses file descriptors instead of HSOCKETs on Windows as
> Eli> well.  Probably it would be best to import Gnulib's 'socket' and
> Eli> 'accept' as well, and use their SOCKET_TO_FD and FD_TO_SOCKET macros
> Eli> if/where needed (hopefully nowhere).  Are there any more related APIs,
> Eli> besides those 3?  I guess, 'close' (which should call 'closesocket' on
> Eli> Windows) and perhaps 'ioctl'?  Gnulib has those as well.
> 
> gdbserver uses setsockopt as well.

And also 'accept' and 'bind', all of them are available in Gnulib.  As
a nice bonus, we get to remove the USE_WIN32API parts that call
'closesocket' where on Posix platforms we call 'close', because
Gnulib's 'close' does that as well.

So, on balance I think if we want to remove USE_WIN32API regarding
sockets and related stuff, importing Gnulib replacements will be much
less work, and might also enable some features that are currently
disabled.


  reply	other threads:[~2019-02-26 16:04 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24 16:51 Tom Tromey
2019-02-24 16:52 ` [RFC 09/17] Introduce async-event.[ch] Tom Tromey
2019-09-26 14:06   ` Pedro Alves
2019-10-04 22:17     ` Tom Tromey
2019-02-24 16:52 ` [RFC 06/17] Include <chrono> in event-loop.c Tom Tromey
2019-09-26 14:02   ` Pedro Alves
2019-02-24 16:52 ` [RFC 05/17] Remove gdb_usleep.c Tom Tromey
2019-09-26 14:02   ` Pedro Alves
2019-09-26 14:43     ` Tom Tromey
2019-02-24 16:52 ` [RFC 04/17] Move gdb_select.h to common/ Tom Tromey
2019-02-24 16:52 ` [RFC 10/17] Move event-loop.[ch] " Tom Tromey
2019-09-26 14:06   ` Pedro Alves
2019-10-04 22:06     ` Tom Tromey
2019-02-24 16:52 ` [RFC 13/17] Switch gdbserver to common event loop Tom Tromey
2019-02-24 16:52 ` [RFC 17/17] Simplify gdbserver's serial event handling Tom Tromey
2019-09-26 17:36   ` Pedro Alves
2019-10-04 22:08     ` Tom Tromey
2019-02-24 16:52 ` [RFC 14/17] Remove some dead code from event-loop.c Tom Tromey
2019-02-24 16:52 ` [RFC 03/17] Move event-loop configury to common.m4 Tom Tromey
2019-02-24 16:52 ` [RFC 15/17] Move gdb_notifier comment Tom Tromey
2019-09-26 14:06   ` Pedro Alves
2019-02-24 16:52 ` [RFC 08/17] Introduce and use flush_streams Tom Tromey
2019-02-24 16:52 ` [RFC 02/17] Move gdb-specific code out of start_event_loop Tom Tromey
2019-09-26 14:02   ` Pedro Alves
2019-02-24 16:52 ` [RFC 07/17] Use warning in event-loop Tom Tromey
2019-09-26 14:02   ` Pedro Alves
2019-02-24 16:52 ` [RFC 01/17] Remove include from event-loop.c Tom Tromey
2019-02-24 16:52 ` [RFC 16/17] Remove gdb_fildes_t Tom Tromey
2019-02-24 16:52 ` [RFC 11/17] Implement event-loop glue for gdbserver Tom Tromey
2019-02-24 16:52 ` [RFC 12/17] Add the ability to stop the event loop Tom Tromey
2019-02-24 17:14 ` [RFC 00/17] Merge event loop implementations Eli Zaretskii
2019-02-24 17:26   ` Tom Tromey
2019-02-24 17:45     ` Eli Zaretskii
2019-02-25 19:57       ` Tom Tromey
2019-02-25 20:30         ` Eli Zaretskii
2019-02-25 20:55           ` Tom Tromey
2019-02-26 16:04             ` Eli Zaretskii [this message]
2019-02-26 16:23               ` Tom Tromey
2019-02-26 16:46                 ` Eli Zaretskii
2019-09-26 17:47 ` Pedro Alves
2019-09-26 23:09   ` Tom Tromey
2019-09-27 13:53     ` Pedro Alves
2019-09-27 14:05       ` Pedro Alves
2019-09-27 14:21         ` Eli Zaretskii
2019-09-27 14:53           ` Pedro Alves
2019-09-27 15:32             ` Eli Zaretskii
2019-09-27 19:10       ` Tom Tromey
2020-02-14  2:22         ` Tom Tromey
2020-02-14 17:58           ` Pedro Alves
2020-02-14 18:36             ` Tom Tromey
2019-10-04 22:25   ` Tom Tromey
2020-02-14 18:20     ` Pedro Alves

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=83y362lenr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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