summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-09-08 17:53:11 +0000
committerRichard M. Stallman <rms@gnu.org>1993-09-08 17:53:11 +0000
commitdd2281ae2a204fe83ccdcae665e34cedb4a480de (patch)
tree9beb59b1b2c6b46032f2141f800d7bcd80246cd2 /src/process.c
parent64e971c33be459710a200492cf1e398197828095 (diff)
downloademacs-dd2281ae2a204fe83ccdcae665e34cedb4a480de.tar.gz
(keyboard_descriptor): New variable.
(wait_reading_process_input, init_keyboard): Use it. Also call change_input_fd. (change_keyboard_wait_descriptor): New function.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/src/process.c b/src/process.c
index 45fec280cce..a7e4a07e5d8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -73,6 +73,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "commands.h"
#include "frame.h"
+Lisp_Object Qprocessp;
Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed;
/* Qexit is declared and initialized in eval.c. */
@@ -150,7 +151,7 @@ char *sys_siglist[] =
/* t means use pty, nil means use a pipe,
maybe other values to come. */
-Lisp_Object Vprocess_connection_type;
+static Lisp_Object Vprocess_connection_type;
#ifdef SKTPAIR
#ifndef HAVE_SOCKETS
@@ -159,10 +160,10 @@ Lisp_Object Vprocess_connection_type;
#endif /* SKTPAIR */
/* Number of events of change of status of a process. */
-int process_tick;
+static int process_tick;
/* Number of events for which the user or sentinel has been notified. */
-int update_tick;
+static int update_tick;
#ifdef FD_SET
/* We could get this from param.h, but better not to depend on finding that.
@@ -187,19 +188,19 @@ int update_tick;
/* Mask of bits indicating the descriptors that we wait for input on */
-SELECT_TYPE input_wait_mask;
+static SELECT_TYPE input_wait_mask;
+
+/* Descriptor to use for keyboard input. */
+static int keyboard_descriptor;
-int delete_exited_processes;
+/* Nonzero means delete a process right away if it exits. */
+static int delete_exited_processes;
/* Indexed by descriptor, gives the process (if any) for that descriptor */
-Lisp_Object chan_process[MAXDESC];
+static Lisp_Object chan_process[MAXDESC];
/* Alist of elements (NAME . PROCESS) */
-Lisp_Object Vprocess_alist;
-
-Lisp_Object Qprocessp;
-
-Lisp_Object get_process ();
+static Lisp_Object Vprocess_alist;
/* Buffered-ahead input char from process, indexed by channel.
-1 means empty (no char is buffered).
@@ -207,7 +208,9 @@ Lisp_Object get_process ();
output from the process is to read at least one char.
Always -1 on systems that support FIONREAD. */
-int proc_buffered_char[MAXDESC];
+static int proc_buffered_char[MAXDESC];
+
+static Lisp_Object get_process ();
/* Compute the Lisp form of the process status, p->status, from
the numeric status that was returned by `wait'. */
@@ -1753,7 +1756,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
but that led to lossage handling selection_request events:
within one, we would start to handle another. */
if (! XINT (read_kbd))
- FD_CLR (0, &Available);
+ FD_CLR (keyboard_descriptor, &Available);
/* If frame size has changed or the window is newly mapped,
redisplay now, before we start to wait. There is a race
@@ -1816,7 +1819,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
error("select error: %s", sys_errlist[xerrno]);
}
#if defined(sun) && !defined(USG5_4)
- else if (nfds > 0 && FD_ISSET (0, &Available) && interrupt_input)
+ else if (nfds > 0 && FD_ISSET (keyboard_descriptor, &Available)
+ && interrupt_input)
/* System sometimes fails to deliver SIGIO.
David J. Mackenzie says that Emacs doesn't compile under
@@ -1851,7 +1855,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
In that case, there really is no input and no SIGIO,
but select says there is input. */
- if (XINT (read_kbd) && interrupt_input && (FD_ISSET (fileno (stdin), &Available)))
+ if (XINT (read_kbd) && interrupt_input
+ && (FD_ISSET (keyboard_descriptor, &Available)))
kill (0, SIGIO);
#endif
@@ -2930,7 +2935,10 @@ init_process ()
#endif
FD_ZERO (&input_wait_mask);
- FD_SET (0, &input_wait_mask);
+
+ keyboard_descriptor = 0;
+ FD_SET (keyboard_descriptor, &input_wait_mask);
+
Vprocess_alist = Qnil;
for (i = 0; i < MAXDESC; i++)
{
@@ -2939,6 +2947,17 @@ init_process ()
}
}
+/* From now on, assume keyboard input comes from descriptor DESC. */
+
+void
+change_keyboard_wait_descriptor (desc)
+ int desc;
+{
+ FD_CLR (keyboard_descriptor, &input_wait_mask);
+ keyboard_descriptor = desc;
+ FD_SET (keyboard_descriptor, &input_wait_mask);
+}
+
syms_of_process ()
{
#ifdef HAVE_SOCKETS