From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: emacs-27 d66331a: Don't build the Gnulib 'utimens' module on MinGW Date: Tue, 24 Mar 2020 18:07:13 +0100 Message-ID: References: <20200323143828.31224.77075@vcs0.savannah.gnu.org> <20200323143829.ED56720E43@vcs0.savannah.gnu.org> <83lfnrax0r.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="69886"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 24 18:07:51 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGn1r-000I4r-5h for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Mar 2020 18:07:51 +0100 Original-Received: from localhost ([::1]:52408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGn1q-0005NH-8n for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Mar 2020 13:07:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54085) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGn1K-0004tp-Ud for emacs-devel@gnu.org; Tue, 24 Mar 2020 13:07:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGn1J-0000Fp-Sh for emacs-devel@gnu.org; Tue, 24 Mar 2020 13:07:18 -0400 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:51520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jGn1J-0000Ds-MM; Tue, 24 Mar 2020 13:07:17 -0400 Original-Received: by mail-wm1-x334.google.com with SMTP id c187so4064493wme.1; Tue, 24 Mar 2020 10:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=tV11JvHAvqE72GTGvZC68oR9stVhvAc0xQcuOsD7SZc=; b=obcyfi+rE83W5efFIL6DprygNsnhsEekjXbbUxBZOxXWikaICuXHPhIdjNUNda95Nn dWtU9WPc+qsHwwWqRmeparYmxAcNYLFcznBw5xPXa9vL2nWKcFQ//KW8PC2dV0MeOKPW pNwmQpXy2u/blq/XkVuGGPvoHLTqjytZ12X1iPZpbOCgRocgDvpVLaxnCulMAhV+GVpJ fMihEa9kOknNFJxcnPNPG/ZyNgzypHZ6wd8T4fUTmBKk8ENogHjG2u2dX5MfRZJ2b+V4 ioL6MmMLD481Fh6C5gBmQXzKSu2rLvhMmplZ0RlBNAcTn2wo1Y88gY++WMAHIjZIYK9s D+RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=tV11JvHAvqE72GTGvZC68oR9stVhvAc0xQcuOsD7SZc=; b=GkLQlaEhTu0qWQ8n0RuQAMxJKGIavk0mCNLIndk9Vb1yHRUv5oMDAjkUm+8ff0C2Tx GUvezRnIox+EKUW3NqUORdx/MQK0Jj/+2UApMHeZGDGqskNRnpgC/b9/b3dMj1pzB/h4 XXAr0YphBNc089oLkVoUbajKJa1cglccbtNwGi4sWTtw40cDmXqM/L2DCLsHsSoELdqL AKRf+vBMkEvoIaPo1jBFNyqmjy+6whob4rjOSeG6DUHfhyAIMreLTpYjbVv0LqKFdt6b mjlSznHmpFnMPML1+Wxarj7PaB0MMB9iVufP+Ajd9ytS2M3hkRdngzb5ngnnYdVMo+Tx 6u4w== X-Gm-Message-State: ANhLgQ0YpEA5H5CJ9HNtp2zOHKcNMEfCAjUCSnj2UKb5ugnSXERGxOW7 2v8HWqyOnPC4BPvsiPidWceqcZfy X-Google-Smtp-Source: ADFU+vvj1Si3aSttOg3GKiQbek12ss4BMo1XkAwBKE3c7Q2ypX5+AquobEhwdbTOF2TdKajwo8wvFg== X-Received: by 2002:a1c:6146:: with SMTP id v67mr6999540wmb.78.1585069634933; Tue, 24 Mar 2020 10:07:14 -0700 (PDT) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:5432:f8b5:445f:afcd]) by smtp.gmail.com with ESMTPSA id e1sm30469242wrx.90.2020.03.24.10.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 10:07:14 -0700 (PDT) In-Reply-To: <83lfnrax0r.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 23 Mar 2020 17:52:52 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245763 Archived-At: >>>>> On Mon, 23 Mar 2020 17:52:52 +0200, Eli Zaretskii said: >> From: Robert Pluim >> Cc: Eli Zaretskii >> Date: Mon, 23 Mar 2020 16:26:24 +0100 >>=20 >> Apropos: we explicitly don=CA=BCt use the gnulib 'select' module, ev= en >> though it looks like on MSWindows it handles both sockets and >> pipes. What functionality is it missing? Eli> SIGCHLD and C-g interrupts, I guess. Maybe something else as well= , I Eli> don't remember. In that case I should go the other direction. How about the following to remove the 1-char readahead for sockets (which then allows us to enable datagram sockets on MSWindows). modified src/w32.c @@ -8798,6 +8798,43 @@ _sys_wait_accept (int fd) return cp->status; } =20 +int +_sys_wait_readable (int fd) +{ + HANDLE hEv; + child_process * cp; + int rc; + + if (fd < 0 || fd >=3D MAXDESC) + return STATUS_READ_ERROR; + + cp =3D fd_info[fd].cp; + + if (cp =3D=3D NULL || cp->fd !=3D fd || cp->status !=3D STATUS_READ_READ= Y) + return STATUS_READ_ERROR; + + cp->status =3D STATUS_READ_FAILED; + + hEv =3D pfn_WSACreateEvent (); + rc =3D pfn_WSAEventSelect (SOCK_HANDLE (fd), hEv, FD_READ); + if (rc !=3D SOCKET_ERROR) + { + do + { + rc =3D WaitForSingleObject (hEv, 500); + Sleep (5); + } while (rc =3D=3D WAIT_TIMEOUT + && cp->status !=3D STATUS_READ_ERROR + && cp->char_avail); + pfn_WSAEventSelect (SOCK_HANDLE (fd), NULL, 0); + if (rc =3D=3D WAIT_OBJECT_0) + cp->status =3D STATUS_READ_SUCCEEDED; + } + pfn_WSACloseEvent (hEv); + + return cp->status; +} + int _sys_wait_connect (int fd) { @@ -8923,10 +8960,6 @@ sys_read (int fd, char * buffer, unsigned int count) return -1; =20 case STATUS_READ_SUCCEEDED: - /* consume read-ahead char */ - *buffer++ =3D cp->chr; - count--; - nchars++; cp->status =3D STATUS_READ_ACKNOWLEDGED; ResetEvent (cp->char_avail); =20 modified src/w32.h @@ -175,6 +175,7 @@ #define FILE_SERIAL 0x0800 =20 extern int _sys_read_ahead (int fd); extern int _sys_wait_accept (int fd); +extern int _sys_wait_readable (int fd); extern int _sys_wait_connect (int fd); =20 extern HMODULE w32_delayed_load (Lisp_Object); modified src/w32proc.c @@ -1225,7 +1225,10 @@ reader_thread (void *arg) else if (cp->fd >=3D 0 && (fd_info[cp->fd].flags & FILE_LISTEN) !=3D= 0) rc =3D _sys_wait_accept (cp->fd); else - rc =3D _sys_read_ahead (cp->fd); + if (fd_info[cp->fd].flags & FILE_SOCKET) + rc =3D _sys_wait_readable (cp->fd); + else + rc =3D _sys_read_ahead (cp->fd); =20 /* Don't bother waiting for the event if we already have been told to exit by delete_child. */