From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41747 invoked by alias); 31 Aug 2018 15:10:48 -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 41729 invoked by uid 89); 31 Aug 2018 15:10:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=sk:skskey, UD:sks-keyservers.net, sk:sks-key, 1024d X-HELO: jocasta.intra Received: from de.cellform.com (HELO jocasta.intra) (88.217.224.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 31 Aug 2018 15:10:44 +0000 Received: from jocasta.intra (localhost [127.0.0.1]) by jocasta.intra (8.15.2/8.15.2/Debian-8) with ESMTPS id w7VFAcHT012157 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Aug 2018 17:10:38 +0200 Received: (from john@localhost) by jocasta.intra (8.15.2/8.15.2/Submit) id w7VFAcQ1012156; Fri, 31 Aug 2018 17:10:38 +0200 Date: Fri, 31 Aug 2018 15:10:00 -0000 From: John Darrington To: Eli Zaretskii Cc: John Darrington , gdb-patches@sourceware.org Subject: Re: [PATCH] Allow remote debugging over a local domain socket Message-ID: <20180831151038.xwn4drwycgyjkveo@jocasta.intra> References: <874lfd5gjt.fsf@tromey.com> <20180831101818.9175-1-john@darrington.wattle.id.au> <83efee37mg.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83efee37mg.fsf@gnu.org> User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2018-08/txt/msg00863.txt.bz2 On Fri, Aug 31, 2018 at 05:58:47PM +0300, Eli Zaretskii wrote: > +int > +socket_read_prim (struct serial *scb, size_t count) > +{ > + /* Need to cast to silence -Wpointer-sign on MinGW, as Winsock's > + 'recv' takes 'char *' as second argument, while 'scb->buf' is > + 'unsigned char *'. */ > + return recv (scb->fd, (char *) scb->buf, count, 0); > +} > + > +int > +socket_write_prim (struct serial *scb, const void *buf, size_t count) > +{ > + /* On Windows, the second parameter to send is a "const char *"; on > + UNIX systems it is generally "const void *". The cast to "const > + char *" is OK everywhere, since in C++ any data pointer type can > + be implicitly converted to "const void *". */ > + return send (scb->fd, (const char *) buf, count, 0); > +} I'm confused: why does this mention MinGW and Windows, when Windows doesn't support AF_UNIX (AFAIK)? Should this stuff even be compiled on Windows? > +#ifdef USE_WIN32API > + /* Do nothing; Windoze does not have local domain sockets. */ Exactly! > - ops = serial_interface_lookup ("hardwire"); > + { > + /* Check to see if name is a socket. If it is, then treat is > + as such. Otherwise assume that it's a character device. */ > + struct stat sb; > + if (0 == stat (name, &sb) && ((sb.st_mode & S_IFMT) == S_IFSOCK)) AFAIK, S_IFSOCK is not defined in the MinGW headers, so we need some replacement definition, or we need to ifdef this away in the Windows build. I am told, that the recent versions of Windows 10 do indeed have local domain sockets. But if you like, I can conditionally include the file in the SER_HARDWIRE variable. Then the whole issue is moot. J' -- Avoid eavesdropping. Send strong encrypted email. PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key.