/* Asynchronous subprocess control for GNU Emacs.
- Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1986, 1987, 1988, 1993 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#ifndef VMS
#ifndef WAITTYPE
-#if !defined (BSD) && !defined (UNIPLUS) && !defined (STRIDE) && !(defined (HPUX) && !defined (NOMULTIPLEJOBS)) && !defined (HAVE_WAIT_HEADER)
+#if (!defined (BSD) && !defined (UNIPLUS) && !defined (STRIDE) && !(defined (HPUX) && !defined (NOMULTIPLEJOBS)) && !defined (HAVE_WAIT_HEADER)) || defined (LINUX)
#define WAITTYPE int
#define WIFSTOPPED(w) ((w&0377) == 0177)
#define WIFSIGNALED(w) ((w&0377) != 0177 && (w&~0377) == 0)
#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>
#ifndef VMS
#ifndef BSD4_1
+#ifndef LINUX
extern char *sys_siglist[];
+#endif
#else
char *sys_siglist[] =
{
/* We could get this from param.h, but better not to depend on finding that.
And better not to risk that it might define other symbols used in this
file. */
+#ifdef FD_SETSIZE
+#define MAXDESC FD_SETSIZE
+#else
#define MAXDESC 64
+#endif
#define SELECT_TYPE fd_set
#else /* no FD_SET */
#define MAXDESC 32
{
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 (access (pty_name, 6) != 0)
{
close (fd);
-#ifndef IRIS
+#if !defined(IRIS) && !defined(__sgi)
continue;
#else
return -1;
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;
setsid ();
#ifdef TIOCSCTTY
/* Make the pty's terminal the controlling terminal. */
- if (pty_flag && (ioctl (xforkin, TIOCSCTTY, 0) < 0))
- abort ();
+ if (pty_flag)
+ /* We ignore the return value
+ because faith@cs.unc.edu says that is necessary on Linux. */
+ ioctl (xforkin, TIOCSCTTY, 0);
#endif
#else /* not HAVE_SETSID */
#ifdef USG
host_info.h_name = 0;
host_info.h_aliases = 0;
host_info.h_addrtype = AF_INET;
- host_info.h_addr_list = &(addr_list[0]);
- addr_list[0] = (char*)(&numeric_addr);
+#ifdef h_addr
+ /* Older machines have only one address slot called h_addr.
+ Newer machines have h_addr_list, but #define h_addr to
+ be its first element. */
+ host_info.h_addr_list = &(addr_list[0]);
+#endif
+ host_info.h_addr = (char*)(&numeric_addr);
addr_list[1] = 0;
host_info.h_length = strlen (addr_list[0]);
}
{
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
Atemp = input_wait_mask;
EMACS_SET_SECS_USECS (timeout, 0, 0);
if (select (MAXDESC, &Atemp, 0, 0, &timeout) <= 0)
- status_notify ();
+ {
+ /* 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 ();
+ }
}
/* Don't wait for output from a non-running process. */
update_status (wait_proc);
if (wait_proc != 0
&& ! EQ (wait_proc->status, Qrun))
- break;
+ {
+ clear_waiting_for_input ();
+ break;
+ }
/* Wait till there is something to do */
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
to give it higher priority than subprocesses */
if (XINT (read_kbd) && detect_input_pending ())
- break;
+ {
+ swallow_events ();
+ if (detect_input_pending ())
+ break;
+ }
/* Exit now if the cell we're waiting for became non-nil. */
if (wait_for_cell && ! NILP (*wait_for_cell))
hitting ^G when a filter happens to be running won't screw
it up. */
int count = specpdl_ptr - specpdl;
+ Lisp_Object odeactivate;
+
+ odeactivate = Vdeactivate_mark;
+
specbind (Qinhibit_quit, Qt);
call2 (outstream, proc, make_string (chars, nchars));
+ /* Deactivate the mark now, so it doesn't happen
+ *after* the following command. */
+ if (!NILP (current_buffer->mark_active))
+ {
+ if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
+ {
+ current_buffer->mark_active = Qnil;
+ call1 (Vrun_hooks, intern ("deactivate-mark-hook"));
+ }
+ }
+ Vdeactivate_mark = odeactivate;
+
#ifdef VMS
start_vms_process_read (vs);
#endif
{
Lisp_Object old_read_only;
Lisp_Object old_begv, old_zv;
+ Lisp_Object odeactivate;
+
+ odeactivate = Vdeactivate_mark;
Fset_buffer (p->buffer);
opoint = point;
if (XFASTINT (old_begv) != BEGV || XFASTINT (old_zv) != ZV)
Fnarrow_to_region (old_begv, old_zv);
+ /* Deactivate the mark now, so it doesn't happen
+ *after* the following command. */
+ if (!NILP (current_buffer->mark_active))
+ {
+ if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
+ {
+ current_buffer->mark_active = Qnil;
+ call1 (Vrun_hooks, intern ("deactivate-mark-hook"));
+ }
+ }
+
+ Vdeactivate_mark = odeactivate;
+
current_buffer->read_only = old_read_only;
SET_PT (opoint);
set_buffer_internal (old);
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 */