#endif /* BSD or UNIPLUS or STRIDE */
#endif /* no WAITTYPE */
#else /* VMS */
-
-/* For the CMU PTY driver + */
-#define DCL_PROMPT "$ "
-/* This is a hack. I have no idea what needs to go here, but this */
-/* will get it to compile. We can fix it later. rbr */
#define WAITTYPE int
+#define WIFSTOPPED(w) 0
+#define WIFSIGNALED(w) 0
+#define WIFEXITED(w) ((w) != -1)
+#define WRETCODE(w) (w)
+#define WSTOPSIG(w) (w)
+#define WCOREDUMP(w) 0
+#define WTERMSIG(w) (w)
#include <ssdef.h>
#include <iodef.h>
#include <clidef.h>
#endif
#endif /* VMS */
-#ifdef vipc
-
-#include "vipc.h"
-extern int comm_server;
-extern int net_listen_address;
-#endif /* vipc */
-
/* t means use pty, nil means use a pipe,
maybe other values to come. */
Lisp_Object Vprocess_connection_type;
{
if (code == 0)
return build_string ("finished\n");
- string = Fint_to_string (make_number (code));
+ string = Fnumber_to_string (make_number (code));
string2 = build_string (coredump ? " (core dumped)\n" : "\n");
return concat2 (build_string ("exited abnormally with code "),
concat2 (string, string2));
if (new_argv[0][0] != '/')
{
tem = Qnil;
- openp (Vexec_path, program, "", &tem, 1);
+ openp (Vexec_path, program, EXEC_SUFFIXES, &tem, 1);
if (NILP (tem))
report_file_error ("Searching for program", Fcons (program, Qnil));
new_argv[0] = XSTRING (tem)->data;
{
VMS_PROC_STUFF *get_vms_process_pointer (), *vs;
sys$dassgn (outchannel);
- vs = get_vms_process_pointer (p->pid)
+ vs = get_vms_process_pointer (p->pid);
if (vs)
give_back_vms_process_stuff (vs);
}
zero for no limit, or
-1 means gobble data immediately available but don't wait for any.
+ microsecs is:
+ an additional duration to wait (if time_limit is greater than
+ zero), specified in millisec.
+
read_kbd is a lisp value:
0 to ignore keyboard input, or
1 to return when input is available, or
- -1 means caller will actually read the input, so don't throw to
+ -1 meaning caller will actually read the input, so don't throw to
the quit handler, or
+ a cons cell, meaning wait wait until its car is non-nil, or
a process object, meaning wait until something arrives from that
process. The return value is true iff we read some input from
that process.
int wait_channel = 0;
struct Lisp_Process *wait_proc = 0;
int got_some_input = 0;
+ Lisp_Object *wait_for_cell = 0;
FD_ZERO (&Available);
XFASTINT (read_kbd) = 0;
}
+ /* If waiting for non-nil in a cell, record where. */
+ if (XTYPE (read_kbd) == Lisp_Cons)
+ {
+ wait_for_cell = &XCONS (read_kbd)->car;
+ XFASTINT (read_kbd) = 0;
+ }
+
waiting_for_user_input_p = XINT (read_kbd);
/* Since we may need to wait several times,
EMACS_SET_SECS_USECS (timeout, 100000, 0);
}
- /* Cause C-g and alarm signals to take immediate action,
- and cause input available signals to zero out timeout.
-
- It is important that we do this before checking for process
- activity. If we get a SIGCHLD after the explicit checks for
- process activity, timeout is the only way we will know. */
- if (XINT (read_kbd) < 0)
- set_waiting_for_input (&timeout);
-
/* If status of something has changed, and no input is
available, notify the user of the change right away. After
this explicit check, we'll let the SIGCHLD handler zap
status_notify ();
}
+ /* Cause C-g and alarm signals to take immediate action,
+ and cause input available signals to zero out timeout.
+
+ It is important that we do this before checking for process
+ activity. If we get a SIGCHLD after the explicit checks for
+ process activity, timeout is the only way we will know. */
+ if (XINT (read_kbd) < 0)
+ set_waiting_for_input (&timeout);
+
/* Don't wait for output from a non-running process. */
if (wait_proc != 0 && !NILP (wait_proc->raw_status_low))
update_status (wait_proc);
else
error("select error: %s", sys_errlist[xerrno]);
}
-#ifdef sun
+#if defined(sun) && !defined(USG5_4)
else if (nfds > 0 && FD_ISSET (0, &Available) && interrupt_input)
- /* System sometimes fails to deliver SIGIO. */
+ /* System sometimes fails to deliver SIGIO.
+
+ David J. Mackenzie says that Emacs doesn't compile under
+ Solaris if this code is enabled, thus the USG5_4 in the CPP
+ conditional. "I haven't noticed any ill effects so far.
+ If you find a Solaris expert somewhere, they might know
+ better." */
kill (getpid (), SIGIO);
#endif
if (XINT (read_kbd) && detect_input_pending ())
break;
+ /* Exit now if the cell we're waiting for became non-nil. */
+ if (wait_for_cell && ! NILP (*wait_for_cell))
+ break;
+
#ifdef SIGIO
/* If we think we have keyboard input waiting, but didn't get SIGIO
go read it. This can happen with X on BSD after logging out.
In that case, there really is no input and no SIGIO,
but select says there is input. */
- /*
- if (XINT (read_kbd) && interrupt_input && (Available & fileno (stdin)))
- */
if (XINT (read_kbd) && interrupt_input && (FD_ISSET (fileno (stdin), &Available)))
kill (0, SIGIO);
#endif
-#ifdef vipc
- /* Check for connection from other process */
-
- if (Available & ChannelMask (comm_server))
- {
- Available &= ~(ChannelMask (comm_server));
- create_commchan ();
- }
-#endif /* vipc */
-
if (! wait_proc)
got_some_input |= nfds > 0;
if (NILP (proc))
continue;
-#ifdef vipc
- /* It's a command channel */
- if (!NILP (XPROCESS (proc)->command_channel_p))
- {
- ProcessCommChan (channel, proc);
- if (NILP (XPROCESS (proc)->command_channel_p))
- {
- /* It has ceased to be a command channel! */
- int bytes_available;
- if (ioctl (channel, FIONREAD, &bytes_available) < 0)
- bytes_available = 0;
- if (bytes_available)
- FD_SET (channel, &Available);
- }
- continue;
- }
-#endif /* vipc */
-
/* Read data from the process, starting with our
buffered-ahead character if we have one. */
case SIGINT:
tcgetattr (XFASTINT (p->infd), &t);
send_process (proc, &t.c_cc[VINTR], 1);
- return Qnil;
+ return;
case SIGQUIT:
tcgetattr (XFASTINT (p->infd), &t);
send_process (proc, &t.c_cc[VQUIT], 1);
- return Qnil;
+ return;
case SIGTSTP:
tcgetattr (XFASTINT (p->infd), &t);
#else
send_process (proc, &t.c_cc[VSUSP], 1);
#endif
- return Qnil;
+ return;
}
#else /* ! HAVE_TERMIOS */
Lisp_Object proc;
proc = get_process (process);
+
+ /* Make sure the process is really alive. */
+ if (! NILP (XPROCESS (proc)->raw_status_low))
+ update_status (XPROCESS (proc));
+ if (! EQ (XPROCESS (proc)->status, Qrun))
+ error ("Process %s not running", XSTRING (XPROCESS (proc)->name)->data);
+
/* Sending a zero-length record is supposed to mean eof
when TIOCREMOTE is turned on. */
#ifdef DID_REMOTE
else
{
close (XPROCESS (proc)->outfd);
- XFASTINT (XPROCESS (proc)->outfd) = open ("/dev/null", O_WRONLY);
+ XFASTINT (XPROCESS (proc)->outfd) = open (NULL_DEVICE, O_WRONLY);
}
#endif /* VMS */
#endif /* did not do TOICREMOTE */
break;
}
+ start_polling ();
+
return 0;
}