From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124665 invoked by alias); 25 Feb 2019 20:55:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 124203 invoked by uid 89); 25 Feb 2019 20:55:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=use_win32api, USE_WIN32API, sk:add_fil X-HELO: gateway21.websitewelcome.com Received: from gateway21.websitewelcome.com (HELO gateway21.websitewelcome.com) (192.185.45.89) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Feb 2019 20:55:17 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 48833400DC2FB for ; Mon, 25 Feb 2019 14:55:15 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id yNHPgsQwE4FKpyNHPgAcHj; Mon, 25 Feb 2019 14:55:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JnMelLLPChWHWeSUNUanvYgvbB3WLDdwj9/4Bsjdh6w=; b=smpCeypiZs2LQckP3kC/27UijL GyaegLAljtP+jGe2xNih51b+lwywn2FV+4zrZQp+22zE/xpyT5/YpjlUykyZ3feL/ry0Rqp73beC9 1tTfu1NrGjArHWlXEwfphk9qx; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:59068 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gyNHP-002VSu-0Y; Mon, 25 Feb 2019 14:55:15 -0600 From: Tom Tromey To: Eli Zaretskii Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFC 00/17] Merge event loop implementations References: <20190224165153.5062-1-tom@tromey.com> <83sgwdnm6r.fsf@gnu.org> <87va19jdy4.fsf@tromey.com> <83r2bxnkrb.fsf@gnu.org> <87imx7vdxe.fsf@tromey.com> <83lg23mx18.fsf@gnu.org> Date: Mon, 25 Feb 2019 20:55:00 -0000 In-Reply-To: <83lg23mx18.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 25 Feb 2019 22:29:55 +0200") Message-ID: <87o96ztwpa.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-02/txt/msg00421.txt.bz2 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. 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. 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. Tom