unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete
@ 2016-03-08 17:40 Lars Magne Ingebrigtsen
  2016-03-08 17:48 ` Eli Zaretskii
  2016-03-22  8:21 ` Paul Eggert
  0 siblings, 2 replies; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2016-03-08 17:40 UTC (permalink / raw)
  To: 22946


According to Paul and Eli, Emacs no longer have any build targets where
NON_BLOCKING_CONNECT (in process.c) is undefined.  So the relevant code
paths should be cleaned up.

(I'm just mentioning it here so that we don't forget.)



In GNU Emacs 25.1.50.23 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
 of 2016-03-06 built on stories
Repository revision: 20cc4182598c6c724f4556faf6bc322c9e58ad1d
Windowing system distributor 'The X.Org Foundation', version 11.0.11204000
System Description:	Debian GNU/Linux 7.9 (wheezy)

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GSETTINGS NOTIFY GNUTLS
LIBXML2 FREETYPE LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_US
  locale-coding-system: iso-latin-1-unix

Major mode: Group

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  gnus-topic-mode: t
  gnus-undo-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t

Recent messages:
Saving file /home/larsi/.newsrc...
Wrote /home/larsi/.newsrc
Saving /home/larsi/.newsrc.eld...
Saving file /home/larsi/.newsrc.eld...
Wrote /home/larsi/.newsrc.eld
Saving /home/larsi/.newsrc.eld...done
No more unseen articles
No more unread articles
Mark set
Making completion list...

Load-path shadows:
/home/larsi/src/clock.el/clock hides /home/larsi/lisp/clock
/home/larsi/src/cddb.el/expect hides /home/larsi/lisp/expect
/home/larsi/src/pvr.el/pvr hides /home/larsi/lisp/pvr
~/pgnus/contrib/vcard hides /home/larsi/lisp/vcard
/home/larsi/src/cddb.el/captitle hides /home/larsi/lisp/captitle
~/lisp/zenirc-2.112/src/zenirc-example hides /home/larsi/lisp/zenirc-example
/home/larsi/lisp/dom hides /home/larsi/src/emacs/trunk/lisp/dom
~/pgnus/contrib/compface hides /home/larsi/src/emacs/trunk/lisp/image/compface

Features:
(ffap nndir nnspool crm two-column server etags tramp-cache tramp
tramp-compat tramp-loaddefs trampver ucs-normalize advice log-edit
pcvs-util noutline outline csid atom json vcalendar shell pcomplete grep
compile comint vc-bzr dired-aux cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs pulse xref project
ring sh-script smie executable mailalias smtpmail vc-git diff-mode map
pp shadow emacsbug sendmail binhex canlock ecomplete flow-fill eieio-opt
speedbar sb-image ezimage dframe find-func thingatpt view sgml-mode
misearch multi-isearch tabify imenu man vc vc-dispatcher copyright
vc-cvs eww shr-color color gnus-html url-queue help-fns url-cache
gnus-picon sort gnus-cite smiley ansi-color mm-archive gnus-async
gnus-dup qp gnus-ml gmane spam-gmane dns mm-url disp-table gnus-fun
gnus-mdrtn gnus-topic pop3 nndoc nnmbox nndraft utf-7 nnmh nnml nnfolder
network-stream nsm starttls nnir spam-report spam spam-stat gnus-uu yenc
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 mm-view mml-smime smime dig nntp gnus-cache gnus-sum
gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message
format-spec rfc822 mml mml-sec epa epg mailabbrev gmm-utils mailheader
gnus-win gnus nnheader gnus-util rmail rmail-loaddefs mail-utils movie
mkv shr svg imdb dom pvr debug debbugs-gnu easy-mmode derived debbugs
soap-client mm-decode mm-bodies mm-encode url-http tls gnutls url-auth
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw puny url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap warnings rng-xsd rng-dt rng-util xsd-regexp xml ido seq
flyspell ispell benchmark w3m browse-url doc-view subr-x dired
dired-loaddefs image-mode timezone w3m-hist w3m-fb w3m-ems wid-edit
w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util add-log mail-extr
mm-util mail-prsvr jka-compr cl finder-inf package epg-config
url-handlers url-parse auth-source cl-seq eieio byte-opt bytecomp
byte-compile cl-extra help-mode easymenu cconv eieio-core cl-macs gv
eieio-loaddefs cl-loaddefs pcase cl-lib password-cache url-vars
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 8764641 539415)
 (symbols 48 177996 451)
 (miscs 40 1537 7583)
 (strings 32 555309 323603)
 (string-bytes 1 37875822)
 (vectors 16 78134)
 (vector-slots 8 2170890 185713)
 (floats 8 8845 9521)
 (intervals 56 2055217 6168)
 (buffers 976 268)
 (heap 1024 486331 190234))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete
  2016-03-08 17:40 bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete Lars Magne Ingebrigtsen
@ 2016-03-08 17:48 ` Eli Zaretskii
  2016-03-08 17:51   ` Lars Magne Ingebrigtsen
  2016-03-22  8:21 ` Paul Eggert
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-03-08 17:48 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 22946

> From: Lars Magne Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 08 Mar 2016 18:40:21 +0100
> 
> According to Paul and Eli, Emacs no longer have any build targets where
> NON_BLOCKING_CONNECT (in process.c) is undefined.  So the relevant code
> paths should be cleaned up.
> 
> (I'm just mentioning it here so that we don't forget.)

We (i.e. Paul) didn't forget: that code just got removed from master.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete
  2016-03-08 17:48 ` Eli Zaretskii
@ 2016-03-08 17:51   ` Lars Magne Ingebrigtsen
  2016-03-08 17:56     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2016-03-08 17:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 22946

Eli Zaretskii <eliz@gnu.org> writes:

> We (i.e. Paul) didn't forget: that code just got removed from master.

Hm.

[larsi@stories ~/src/emacs/trunk]$ git pull --rebase
Current branch master is up to date.
[larsi@stories ~/src/emacs/trunk]$ grep NON_BLOCKING_CONNECT src/process.c
/* Define NON_BLOCKING_CONNECT if we can support non-blocking connects.
   The code can be simplified by assuming NON_BLOCKING_CONNECT once
# define NON_BLOCKING_CONNECT
#ifdef NON_BLOCKING_CONNECT
#endif  /* NON_BLOCKING_CONNECT */
#ifdef NON_BLOCKING_CONNECT
#ifdef NON_BLOCKING_CONNECT
#ifdef NON_BLOCKING_CONNECT
#ifndef NON_BLOCKING_CONNECT
#ifdef NON_BLOCKING_CONNECT
#ifdef NON_BLOCKING_CONNECT
#ifdef NON_BLOCKING_CONNECT
#endif /* NON_BLOCKING_CONNECT */
#ifdef NON_BLOCKING_CONNECT
#ifdef NON_BLOCKING_CONNECT


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete
  2016-03-08 17:51   ` Lars Magne Ingebrigtsen
@ 2016-03-08 17:56     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2016-03-08 17:56 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 22946

> From: Lars Magne Ingebrigtsen <larsi@gnus.org>
> Cc: 22946@debbugs.gnu.org
> Date: Tue, 08 Mar 2016 18:51:36 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > We (i.e. Paul) didn't forget: that code just got removed from master.
> 
> Hm.

Sorry, I confused this with getaddrinfo and stuff.  Oops.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete
  2016-03-08 17:40 bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete Lars Magne Ingebrigtsen
  2016-03-08 17:48 ` Eli Zaretskii
@ 2016-03-22  8:21 ` Paul Eggert
  2016-03-22 16:10   ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Paul Eggert @ 2016-03-22  8:21 UTC (permalink / raw)
  To: 22946-done

[-- Attachment #1: Type: text/plain, Size: 64 bytes --]

I installed the attached patch, to assume NON_BLOCKING_CONNECT.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Assume-NON_BLOCKING_CONNECT-Bug-22946.patch --]
[-- Type: text/x-diff; name="0001-Assume-NON_BLOCKING_CONNECT-Bug-22946.patch", Size: 7890 bytes --]

From d8c3ca9353343726b202e260bca0fd03e298578f Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 22 Mar 2016 01:17:56 -0700
Subject: [PATCH] Assume NON_BLOCKING_CONNECT (Bug#22946)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/proced.el (proced-signal-list): Omit comment about
obsolete systems that do not support POSIX 1003.1-2001 signals.
* src/process.c (NON_BLOCKING_CONNECT): Remove, since we can now
assume POSIX 1003.1-2001 or better here.  Assume it’s defined.
(connect_network_socket): Assume EINPROGRESS is defined,
as that’s portable too now.
(Fmake_network_process): Use bool for boolean.
---
 lisp/proced.el |  3 ---
 src/process.c  | 53 +++++------------------------------------------------
 2 files changed, 5 insertions(+), 51 deletions(-)

diff --git a/lisp/proced.el b/lisp/proced.el
index dee646c..db45e20 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -78,9 +78,6 @@ proced-signal-list
     ("KILL" . "  (9.  Kill - cannot be caught or ignored)")
     ("ALRM" . "  (14. Alarm Clock)")
     ("TERM" . "  (15. Termination)")
-    ;; POSIX 1003.1-2001
-    ;; Which systems do not support these signals so that we can
-    ;; exclude them from `proced-signal-list'?
     ("CONT" . "  (Continue executing)")
     ("STOP" . "  (Stop executing / pause - cannot be caught or ignored)")
     ("TSTP" . "  (Terminal stop / pause)"))
diff --git a/src/process.c b/src/process.c
index a518c2b..198e7de 100644
--- a/src/process.c
+++ b/src/process.c
@@ -193,16 +193,6 @@ 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.
-   The code can be simplified by assuming NON_BLOCKING_CONNECT once
-   Emacs starts assuming POSIX 1003.1-2001 or later.  */
-
-#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
    "non-destructive" select.  So we require either native select,
@@ -262,7 +252,6 @@ static fd_set non_process_wait_mask;
 
 static fd_set write_mask;
 
-#ifdef NON_BLOCKING_CONNECT
 /* Mask of bits indicating the descriptors that we wait for connect to
    complete on.  Once they complete, they are removed from this mask
    and added to the input_wait_mask and non_keyboard_wait_mask.  */
@@ -271,7 +260,6 @@ static fd_set connect_wait_mask;
 
 /* Number of bits set in connect_wait_mask.  */
 static int num_pending_connects;
-#endif	/* NON_BLOCKING_CONNECT */
 
 /* The largest descriptor currently in use for a process object; -1 if none.  */
 static int max_process_desc;
@@ -3133,7 +3121,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses)
 	break;
 #endif /* DATAGRAM_SOCKETS */
 
-#ifdef NON_BLOCKING_CONNECT
       if (p->is_non_blocking_client)
 	{
 	  ret = fcntl (s, F_SETFL, O_NONBLOCK);
@@ -3145,7 +3132,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses)
 	      continue;
 	    }
 	}
-#endif
 
       /* Make us close S if quit.  */
       record_unwind_protect_int (close_file_unwind, s);
@@ -3221,17 +3207,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses)
 	  break;
 	}
 
-#ifdef NON_BLOCKING_CONNECT
-#ifdef EINPROGRESS
       if (p->is_non_blocking_client && xerrno == EINPROGRESS)
 	break;
-#else
-#ifdef EWOULDBLOCK
-      if (p->is_non_blocking_client && xerrno == EWOULDBLOCK)
-	break;
-#endif
-#endif
-#endif
 
 #ifndef WINDOWSNT
       if (xerrno == EINTR)
@@ -3366,7 +3343,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses)
 		     BUF_ZV (XBUFFER (p->buffer)),
 		     BUF_ZV_BYTE (XBUFFER (p->buffer)));
 
-#ifdef NON_BLOCKING_CONNECT
   if (p->is_non_blocking_client)
     {
       /* We may get here if connect did succeed immediately.  However,
@@ -3381,7 +3357,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses)
 	}
     }
   else
-#endif
     /* A server may have a client filter setting of Qt, but it must
        still listen for incoming connects unless it is stopped.  */
     if ((!EQ (p->filter, Qt) && !EQ (p->command, Qt))
@@ -3894,8 +3869,8 @@ usage: (make-network-process &rest ARGS)  */)
     pset_command (p, Qt);
   p->pid = 0;
   p->backlog = 5;
-  p->is_non_blocking_client = 0;
-  p->is_server = 0;
+  p->is_non_blocking_client = false;
+  p->is_server = false;
   p->port = port;
   p->socktype = socktype;
   p->ai_protocol = ai_protocol;
@@ -3918,21 +3893,15 @@ usage: (make-network-process &rest ARGS)  */)
     {
       /* Don't support network sockets when non-blocking mode is
 	 not available, since a blocked Emacs is not useful.  */
-      p->is_server = 1;
+      p->is_server = true;
       if (TYPE_RANGED_INTEGERP (int, tem))
 	p->backlog = XINT (tem);
     }
 
   /* :nowait BOOL */
   if (!p->is_server && socktype != SOCK_DGRAM
-      && (tem = Fplist_get (contact, QCnowait), !NILP (tem)))
-    {
-#ifndef NON_BLOCKING_CONNECT
-      error ("Non-blocking connect not supported");
-#else
-      p->is_non_blocking_client = 1;
-#endif
-    }
+      && !NILP (Fplist_get (contact, QCnowait)))
+    p->is_non_blocking_client = true;
 
 #ifdef HAVE_GETADDRINFO_A
   /* With async address resolution, the list of addresses is empty, so
@@ -4338,7 +4307,6 @@ deactivate_process (Lisp_Object proc)
       chan_process[inchannel] = Qnil;
       FD_CLR (inchannel, &input_wait_mask);
       FD_CLR (inchannel, &non_keyboard_wait_mask);
-#ifdef NON_BLOCKING_CONNECT
       if (FD_ISSET (inchannel, &connect_wait_mask))
 	{
 	  FD_CLR (inchannel, &connect_wait_mask);
@@ -4346,7 +4314,6 @@ deactivate_process (Lisp_Object proc)
 	  if (--num_pending_connects < 0)
 	    emacs_abort ();
 	}
-#endif
       if (inchannel == max_process_desc)
 	{
 	  /* We just closed the highest-numbered process input descriptor,
@@ -4999,11 +4966,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 	  timeout = make_timespec (0, 0);
 	  if ((pselect (max (max_process_desc, max_input_desc) + 1,
 			&Atemp,
-#ifdef NON_BLOCKING_CONNECT
 			(num_pending_connects > 0 ? &Ctemp : NULL),
-#else
-			NULL,
-#endif
 			NULL, &timeout, NULL)
 	       <= 0))
 	    {
@@ -5495,7 +5458,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 				 list2 (Qexit, make_number (256)));
 		}
 	    }
-#ifdef NON_BLOCKING_CONNECT
 	  if (FD_ISSET (channel, &Writeok)
 	      && FD_ISSET (channel, &connect_wait_mask))
 	    {
@@ -5568,7 +5530,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 		    }
 		}
 	    }
-#endif /* NON_BLOCKING_CONNECT */
 	}			/* End for each file descriptor.  */
     }				/* End while exit conditions not met.  */
 
@@ -7780,10 +7741,8 @@ init_process_emacs (void)
   max_process_desc = max_input_desc = -1;
   memset (fd_callback_info, 0, sizeof (fd_callback_info));
 
-#ifdef NON_BLOCKING_CONNECT
   FD_ZERO (&connect_wait_mask);
   num_pending_connects = 0;
-#endif
 
   process_output_delay_count = 0;
   process_output_skip = 0;
@@ -8036,9 +7995,7 @@ The variable takes effect when `start-process' is called.  */);
 #define ADD_SUBFEATURE(key, val) \
   subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures)
 
-#ifdef NON_BLOCKING_CONNECT
    ADD_SUBFEATURE (QCnowait, Qt);
-#endif
 #ifdef DATAGRAM_SOCKETS
    ADD_SUBFEATURE (QCtype, Qdatagram);
 #endif
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete
  2016-03-22  8:21 ` Paul Eggert
@ 2016-03-22 16:10   ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2016-03-22 16:10 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 22946, larsi, eggert

> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Tue, 22 Mar 2016 01:21:18 -0700
> 
> I installed the attached patch, to assume NON_BLOCKING_CONNECT.

Thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-22 16:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-08 17:40 bug#22946: 25.1.50; NON_BLOCKING_CONNECT is obsolete Lars Magne Ingebrigtsen
2016-03-08 17:48 ` Eli Zaretskii
2016-03-08 17:51   ` Lars Magne Ingebrigtsen
2016-03-08 17:56     ` Eli Zaretskii
2016-03-22  8:21 ` Paul Eggert
2016-03-22 16:10   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).