changeset 64977:d26871fb1b7b

(deactivate_process, status_notify, read_process_output) (update_status, status_convert, decode_status, allocate_pty) (make_process, remove_process, list_processes_1) (create_process_1, unwind_request_sigio, read_process_output) (send_process, keyboard_bit_set): Declare static. (Fdelete_process): Simplify. Pass process to status_notify, so we don't try to read output from it. (status_notify): New arg deleting_process--don't try to read output from that process.
author Kim F. Storm <storm@cua.dk>
date Mon, 15 Aug 2005 08:44:53 +0000
parents d2bfb0f1fafc
children 823e9f92b1aa
files src/process.c
diffstat 1 files changed, 38 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/src/process.c	Mon Aug 15 08:44:36 2005 +0000
+++ b/src/process.c	Mon Aug 15 08:44:53 2005 +0000
@@ -294,7 +294,10 @@
 
 #include "sysselect.h"
 
-extern int keyboard_bit_set P_ ((SELECT_TYPE *));
+static int keyboard_bit_set P_ ((SELECT_TYPE *));
+static void deactivate_process P_ ((Lisp_Object));
+static void status_notify P_ ((struct Lisp_Process *));
+static int read_process_output P_ ((Lisp_Object, int));
 
 /* If we support a window system, turn on the code to poll periodically
    to detect C-g.  It isn't actually used when doing interrupt input.  */
@@ -391,9 +394,9 @@
 /* Compute the Lisp form of the process status, p->status, from
    the numeric status that was returned by `wait'.  */
 
-Lisp_Object status_convert ();
-
-void
+static Lisp_Object status_convert ();
+
+static void
 update_status (p)
      struct Lisp_Process *p;
 {
@@ -407,7 +410,7 @@
 /*  Convert a process status word in Unix format to
     the list that we use internally.  */
 
-Lisp_Object
+static Lisp_Object
 status_convert (w)
      WAITTYPE w;
 {
@@ -426,7 +429,7 @@
 /* Given a status-list, extract the three pieces of information
    and store them individually through the three pointers.  */
 
-void
+static void
 decode_status (l, symbol, code, coredump)
      Lisp_Object l;
      Lisp_Object *symbol;
@@ -505,7 +508,7 @@
    The file name of the terminal corresponding to the pty
    is left in the variable pty_name.  */
 
-int
+static int
 allocate_pty ()
 {
   register int c, i;
@@ -590,7 +593,7 @@
 }
 #endif /* HAVE_PTYS */
 
-Lisp_Object
+static Lisp_Object
 make_process (name)
      Lisp_Object name;
 {
@@ -634,7 +637,7 @@
   return val;
 }
 
-void
+static void
 remove_process (proc)
      register Lisp_Object proc;
 {
@@ -768,23 +771,27 @@
      (process)
      register Lisp_Object process;
 {
+  register struct Lisp_Process *p;
+
   process = get_process (process);
-  XPROCESS (process)->raw_status_low = Qnil;
-  XPROCESS (process)->raw_status_high = Qnil;
-  if (NETCONN_P (process))
+  p = XPROCESS (process);
+
+  p->raw_status_low = Qnil;
+  p->raw_status_high = Qnil;
+  if (NETCONN1_P (p))
     {
-      XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
-      XSETINT (XPROCESS (process)->tick, ++process_tick);
-      status_notify ();
+      p->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
+      XSETINT (p->tick, ++process_tick);
+      status_notify (p);
     }
-  else if (XINT (XPROCESS (process)->infd) >= 0)
+  else if (XINT (p->infd) >= 0)
     {
       Fkill_process (process, Qnil);
       /* Do this now, since remove_process will make sigchld_handler do nothing.  */
-      XPROCESS (process)->status
+      p->status
 	= Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));
-      XSETINT (XPROCESS (process)->tick, ++process_tick);
-      status_notify ();
+      XSETINT (p->tick, ++process_tick);
+      status_notify (p);
     }
   remove_process (process);
   return Qnil;
@@ -1238,7 +1245,7 @@
 }
 #endif
 
-Lisp_Object
+static Lisp_Object
 list_processes_1 (query_only)
      Lisp_Object query_only;
 {
@@ -1708,7 +1715,7 @@
   return Qnil;
 }
 
-void
+static void
 create_process_1 (timer)
      struct atimer *timer;
 {
@@ -2531,7 +2538,7 @@
 
 /* A version of request_sigio suitable for a record_unwind_protect.  */
 
-Lisp_Object
+static Lisp_Object
 unwind_request_sigio (dummy)
      Lisp_Object dummy;
 {
@@ -4222,7 +4229,7 @@
 	      /* It's okay for us to do this and then continue with
 		 the loop, since timeout has already been zeroed out.  */
 	      clear_waiting_for_input ();
-	      status_notify ();
+	      status_notify (NULL);
 	    }
 	}
 
@@ -4740,7 +4747,7 @@
    The characters read are decoded according to PROC's coding-system
    for decoding.  */
 
-int
+static int
 read_process_output (proc, channel)
      Lisp_Object proc;
      register int channel;
@@ -5131,7 +5138,7 @@
 
    This function can evaluate Lisp code and can garbage collect.  */
 
-void
+static void
 send_process (proc, buf, len, object)
      volatile Lisp_Object proc;
      unsigned char *volatile buf;
@@ -5725,7 +5732,7 @@
       p->status = Qrun;
       XSETINT (p->tick, ++process_tick);
       if (!nomsg)
-	status_notify ();
+	status_notify (NULL);
       break;
 #endif /* ! defined (SIGCONT) */
     case SIGINT:
@@ -6393,8 +6400,9 @@
    This is usually done while Emacs is waiting for keyboard input
    but can be done at other times.  */
 
-void
-status_notify ()
+static void
+status_notify (deleting_process)
+     struct Lisp_Process *deleting_process;
 {
   register Lisp_Object proc, buffer;
   Lisp_Object tail, msg;
@@ -6430,6 +6438,7 @@
 		 && ! EQ (p->status, Qlisten)
 		 && ! EQ (p->command, Qt)  /* Network process not stopped.  */
 		 && XINT (p->infd) >= 0
+		 && p != deleting_process
 		 && read_process_output (proc, XINT (p->infd)) > 0);
 
 	  buffer = p->buffer;
@@ -6633,7 +6642,7 @@
 /* Return nonzero if *MASK has a bit set
    that corresponds to one of the keyboard input descriptors.  */
 
-int
+static int
 keyboard_bit_set (mask)
      SELECT_TYPE *mask;
 {