From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: BROKEN_NON_BLOCKING_CONNECT Date: Fri, 27 Mar 2015 10:58:13 -0700 Organization: UCLA Computer Science Department Message-ID: <55159A35.70907@cs.ucla.edu> References: <83384qbw1v.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010303060103090008020206" X-Trace: ger.gmane.org 1427479139 29596 80.91.229.3 (27 Mar 2015 17:58:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Mar 2015 17:58:59 +0000 (UTC) To: Eli Zaretskii , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 27 18:58:51 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YbYWp-0006sh-1J for ged-emacs-devel@m.gmane.org; Fri, 27 Mar 2015 18:58:43 +0100 Original-Received: from localhost ([::1]:51215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbYWo-0006Bm-E7 for ged-emacs-devel@m.gmane.org; Fri, 27 Mar 2015 13:58:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbYWa-0006Bd-Iw for emacs-devel@gnu.org; Fri, 27 Mar 2015 13:58:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbYWZ-0004j8-4y for emacs-devel@gnu.org; Fri, 27 Mar 2015 13:58:28 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:59423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbYWV-0004iK-E2; Fri, 27 Mar 2015 13:58:23 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 3DC3EA60008; Fri, 27 Mar 2015 10:58:15 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sFZ3g-TvZcNU; Fri, 27 Mar 2015 10:58:13 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id D77A7A60005; Fri, 27 Mar 2015 10:58:13 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: <83384qbw1v.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:184407 Archived-At: This is a multi-part message in MIME format. --------------010303060103090008020206 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 03/27/2015 02:59 AM, Eli Zaretskii wrote: > Are there any other platforms that might > need it and the related SELECT_CAN_DO_WRITE_MASK and > NON_BLOCKING_CONNECT? Or can these be deleted now? No platforms should need BROKEN_NON_BLOCKING_CONNECT or SELECT_CAN_DO_WRITE_MASK, so I removed them by applying the attached patch. Platforms that predate POSIX.1-2001 might need NON_BLOCKING_CONNECT, though, since that feature wasn't standardized by POSIX until POSIX.1-2001, so I left that part alone for now. This raises the topic of how far back in history Emacs should go, when trying to support older platforms. Currently Emacs is quite conservative and relies only on POSIX.1-1988 or later. I don't know of any currently-supported GNUish or Unixish platform that doesn't largely conform to POSIX.1-2001 or later, so as far as I know the Emacs code that runs only on hosts predating POSIX-2001 isn't being tested and quite possibly no longer works. So it would make sense for Emacs to start assuming POSIX.1-2001 or later, if there's consensus for doing that. --------------010303060103090008020206 Content-Type: text/x-patch; name="0001-Assume-BROKEN_NON_BLOCKING_CONNECT.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Assume-BROKEN_NON_BLOCKING_CONNECT.patch" >From aea8c06cc89a5db3fe0b4b9ef140d6960eaa495d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 27 Mar 2015 10:36:15 -0700 Subject: [PATCH] Assume !BROKEN_NON_BLOCKING_CONNECT >From a suggestion by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00824.html * process.c (NON_BLOCKING_CONNECT): Simplify by assuming that BROKEN_NON_BLOCKING_CONNECT is not defined. (SELECT_CAN_DO_WRITE_MASK): Remove, and assume it's now true. --- admin/CPP-DEFINES | 1 - src/ChangeLog | 9 +++++++++ src/process.c | 27 +++++++++------------------ 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index 18423c2..796b57d 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -85,7 +85,6 @@ AMPERSAND_FULL_NAME BROKEN_DATAGRAM_SOCKETS BROKEN_FIONREAD BROKEN_GET_CURRENT_DIR_NAME -BROKEN_NON_BLOCKING_CONNECT BROKEN_PTY_READ_AFTER_EAGAIN DEFAULT_SOUND_DEVICE DEVICE_SEP diff --git a/src/ChangeLog b/src/ChangeLog index 98037e8..3f9ab4f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2015-03-27 Paul Eggert + + Assume !BROKEN_NON_BLOCKING_CONNECT + From a suggestion by Eli Zaretskii in: + http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00824.html + * process.c (NON_BLOCKING_CONNECT): Simplify by assuming that + BROKEN_NON_BLOCKING_CONNECT is not defined. + (SELECT_CAN_DO_WRITE_MASK): Remove, and assume it's now true. + 2015-03-27 Eli Zaretskii * lread.c (substitute_object_recurse): For sub-char-tables, start diff --git a/src/process.c b/src/process.c index 3fe8644..2800fa5 100644 --- a/src/process.c +++ b/src/process.c @@ -195,24 +195,15 @@ static EMACS_INT process_tick; /* Number of events for which the user or sentinel has been notified. */ static EMACS_INT update_tick; -/* Define NON_BLOCKING_CONNECT if we can support non-blocking connects. */ +/* Define NON_BLOCKING_CONNECT if we can support non-blocking connects. + The code can be simplified by assuming NON_BLOCKING_CONNECT once + Emacs starts assuming POSIX 1003.1-2001 or later. */ -/* Only W32 has this, it really means that select can't take write mask. */ -#ifdef BROKEN_NON_BLOCKING_CONNECT -#undef NON_BLOCKING_CONNECT -enum { SELECT_CAN_DO_WRITE_MASK = false }; -#else -enum { SELECT_CAN_DO_WRITE_MASK = true }; -#ifndef NON_BLOCKING_CONNECT -#ifdef HAVE_SELECT -#if defined (HAVE_GETPEERNAME) || defined (GNU_LINUX) -#if defined (EWOULDBLOCK) || defined (EINPROGRESS) -#define NON_BLOCKING_CONNECT -#endif /* EWOULDBLOCK || EINPROGRESS */ -#endif /* HAVE_GETPEERNAME || GNU_LINUX */ -#endif /* HAVE_SELECT */ -#endif /* NON_BLOCKING_CONNECT */ -#endif /* BROKEN_NON_BLOCKING_CONNECT */ +#if (defined HAVE_SELECT \ + && (defined GNU_LINUX || defined HAVE_GETPEERNAME) \ + && (defined EWOULDBLOCK || defined EINPROGRESS)) +# define NON_BLOCKING_CONNECT +#endif /* Define DATAGRAM_SOCKETS if datagrams can be used safely on this system. We need to read full packets, so we need a @@ -4606,7 +4597,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, Available = input_wait_mask; Writeok = write_mask; check_delay = wait_proc ? 0 : process_output_delay_count; - check_write = SELECT_CAN_DO_WRITE_MASK; + check_write = true; } /* If frame size has changed or the window is newly mapped, -- 2.1.0 --------------010303060103090008020206--