#include "commands.h"
#include "frame.h"
+Lisp_Object Qprocessp;
Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed;
/* Qexit is declared and initialized in eval.c. */
/* 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
#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.
/* 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).
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 ();
\f
/* Compute the Lisp form of the process status, p->status, from
the numeric status that was returned by `wait'. */
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
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
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
#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++)
{
}
}
+/* 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