+ error ("Undefined signal name %s", name);
+ return 0; /* Unreached */
+ }
+}
+
+/* Send signal number SIGNO to PROCESS.
+ CURRENT-GROUP non-nil means send signal to the current
+ foreground process group of the process's controlling terminal rather
+ than to the process's own process group.
+ This is used for various commands in shell mode.
+ If NOMSG is zero, insert signal-announcements into process's buffers
+ right away.
+
+ If we can, we try to signal PROCESS by sending control characters
+ down the pty. This allows us to signal inferiors who have changed
+ their uid, for which kill() would return an EPERM error, or to
+ processes running on another computer through a remote login. */
+
+static void
+process_send_signal (Lisp_Object process, int signo,
+ int current_group, int nomsg)
+{
+ /* This function can GC */
+ process = get_process (process);
+
+ if (network_connection_p (process))
+ error ("Network connection %s is not a subprocess",
+ XSTRING_DATA (XPROCESS(process)->name));
+ CHECK_LIVE_PROCESS (process);
+
+ MAYBE_PROCMETH (kill_child_process, (process, signo, current_group, nomsg));
+}
+
+DEFUN ("process-send-signal", Fprocess_send_signal, 1, 3, 0, /*
+Send signal SIGNAL to process PROCESS.
+SIGNAL may be an integer, or a symbol naming a signal, like `SIGSEGV'.
+PROCESS may be a process, a buffer, the name of a process or buffer, or
+nil, indicating the current buffer's process.
+Third arg CURRENT-GROUP non-nil means send signal to the current
+foreground process group of the process's controlling terminal rather
+than to the process's own process group.
+If the process is a shell that supports job control, this means
+send the signal to the current subjob rather than the shell.
+*/
+ (signal_, process, current_group))
+{
+ /* This function can GC */
+ process_send_signal (process, decode_signal (signal_),
+ !NILP (current_group), 0);
+ return process;
+}
+
+DEFUN ("interrupt-process", Finterrupt_process, 0, 2, 0, /*
+Interrupt process PROCESS.
+See function `process-send-signal' for more details on usage.
+*/
+ (process, current_group))
+{
+ /* This function can GC */
+ process_send_signal (process, SIGINT, !NILP (current_group), 0);
+ return process;
+}
+
+DEFUN ("kill-process", Fkill_process, 0, 2, 0, /*
+Kill process PROCESS.
+See function `process-send-signal' for more details on usage.
+*/
+ (process, current_group))
+{
+ /* This function can GC */
+#ifdef SIGKILL
+ process_send_signal (process, SIGKILL, !NILP (current_group), 0);
+#else
+ error ("kill-process: Not supported on this system");
+#endif
+ return process;
+}
+
+DEFUN ("quit-process", Fquit_process, 0, 2, 0, /*
+Send QUIT signal to process PROCESS.
+See function `process-send-signal' for more details on usage.
+*/
+ (process, current_group))
+{
+ /* This function can GC */
+#ifdef SIGQUIT
+ process_send_signal (process, SIGQUIT, !NILP (current_group), 0);
+#else
+ error ("quit-process: Not supported on this system");
+#endif
+ return process;
+}
+
+DEFUN ("stop-process", Fstop_process, 0, 2, 0, /*
+Stop process PROCESS.
+See function `process-send-signal' for more details on usage.
+*/
+ (process, current_group))
+{
+ /* This function can GC */
+#ifdef SIGTSTP
+ process_send_signal (process, SIGTSTP, !NILP (current_group), 0);
+#else
+ error ("stop-process: Not supported on this system");
+#endif
+ return process;
+}
+
+DEFUN ("continue-process", Fcontinue_process, 0, 2, 0, /*
+Continue process PROCESS.
+See function `process-send-signal' for more details on usage.
+*/
+ (process, current_group))
+{
+ /* This function can GC */
+#ifdef SIGCONT
+ process_send_signal (process, SIGCONT, !NILP (current_group), 0);
+#else
+ error ("continue-process: Not supported on this system");
+#endif
+ return process;
+}
+
+DEFUN ("signal-process", Fsignal_process, 2, 2,
+ "nProcess number: \nnSignal code: ", /*
+Send the process with process id PID the signal with code SIGNAL.
+PID must be an integer. The process need not be a child of this Emacs.
+SIGNAL may be an integer, or a symbol naming a signal, like `SIGSEGV'.
+*/
+ (pid, signal_))
+{
+ CHECK_INT (pid);
+