[RFC 00/17] Merge event loop implementations

Eli Zaretskii eliz@gnu.org
Fri Sep 27 15:32:00 GMT 2019


> Cc: tom@tromey.com, gdb-patches@sourceware.org
> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 27 Sep 2019 15:53:36 +0100
> 
> Alternatively, if someone feels up to it, we could also borrow
> what gnulib's socket replacement does, which is to use these
> two macros to convert between a socket and a file descriptor:
> 
>  #define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
>  #define SOCKET_TO_FD(fh)   (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))

If you want to use sockets in calls to the likes of 'read' and
'write', then the above is the only way, AFAIK.

> In conclusion, I suggest sweeping the issue under the rug for now
> and cast SOCKET to int for this series, like GDB already does.

I'd suggest to at least have a comment about this somewhere.



More information about the Gdb-patches mailing list