diff options
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 93 |
1 files changed, 50 insertions, 43 deletions
diff --git a/src/process.c b/src/process.c index 7a8ad5c339b..f6dad808ffe 100644 --- a/src/process.c +++ b/src/process.c @@ -2900,7 +2900,7 @@ usage: (make-network-process &rest ARGS) */) /* Make QCaddress an alias for :local (server) or :remote (client). */ QCaddress = is_server ? QClocal : QCremote; - /* :wait BOOL */ + /* :nowait BOOL */ if (!is_server && socktype == SOCK_STREAM && (tem = Fplist_get (contact, QCnowait), !NILP (tem))) { @@ -5144,6 +5144,9 @@ read_process_output (proc, channel) } carryover = nbytes - coding->consumed; + if (carryover < 0) + abort (); + if (SCHARS (p->decoding_buf) < carryover) p->decoding_buf = make_uninit_string (carryover); bcopy (chars + coding->consumed, SDATA (p->decoding_buf), @@ -5254,11 +5257,15 @@ read_process_output (proc, channel) } } carryover = nbytes - coding->consumed; + if (carryover < 0) + abort (); + if (SCHARS (p->decoding_buf) < carryover) p->decoding_buf = make_uninit_string (carryover); bcopy (chars + coding->consumed, SDATA (p->decoding_buf), carryover); XSETINT (p->decoding_carryover, carryover); + /* Adjust the multibyteness of TEXT to that of the buffer. */ if (NILP (current_buffer->enable_multibyte_characters) != ! STRING_MULTIBYTE (text)) @@ -6099,7 +6106,7 @@ If PROCESS is a network process, resume handling of incoming traffic. */) DEFUN ("signal-process", Fsignal_process, Ssignal_process, 2, 2, "sProcess (name or number): \nnSignal code: ", doc: /* Send PROCESS the signal with code SIGCODE. -PROCESS may also be an integer specifying the process id of the +PROCESS may also be a number specifying the process id of the process to signal; in this case, the process need not be a child of this Emacs. SIGCODE may be an integer, or a symbol whose name is a signal name. */) @@ -6116,7 +6123,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) if (FLOATP (process)) { - pid = (pid_t) XFLOAT (process); + pid = (pid_t) XFLOAT_DATA (process); goto got_it; } @@ -6144,8 +6151,8 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) got_it: -#define handle_signal(NAME, VALUE) \ - else if (!strcmp (name, NAME)) \ +#define parse_signal(NAME, VALUE) \ + else if (!xstricmp (name, NAME)) \ XSETINT (sigcode, VALUE) if (INTEGERP (sigcode)) @@ -6157,106 +6164,106 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) CHECK_SYMBOL (sigcode); name = SDATA (SYMBOL_NAME (sigcode)); - if (!strncmp(name, "SIG", 3)) + if (!strncmp(name, "SIG", 3) || !strncmp(name, "sig", 3)) name += 3; if (0) ; +#ifdef SIGUSR1 + parse_signal ("usr1", SIGUSR1); +#endif +#ifdef SIGUSR2 + parse_signal ("usr2", SIGUSR2); +#endif +#ifdef SIGTERM + parse_signal ("term", SIGTERM); +#endif #ifdef SIGHUP - handle_signal ("HUP", SIGHUP); + parse_signal ("hup", SIGHUP); #endif #ifdef SIGINT - handle_signal ("INT", SIGINT); + parse_signal ("int", SIGINT); #endif #ifdef SIGQUIT - handle_signal ("QUIT", SIGQUIT); + parse_signal ("quit", SIGQUIT); #endif #ifdef SIGILL - handle_signal ("ILL", SIGILL); + parse_signal ("ill", SIGILL); #endif #ifdef SIGABRT - handle_signal ("ABRT", SIGABRT); + parse_signal ("abrt", SIGABRT); #endif #ifdef SIGEMT - handle_signal ("EMT", SIGEMT); + parse_signal ("emt", SIGEMT); #endif #ifdef SIGKILL - handle_signal ("KILL", SIGKILL); + parse_signal ("kill", SIGKILL); #endif #ifdef SIGFPE - handle_signal ("FPE", SIGFPE); + parse_signal ("fpe", SIGFPE); #endif #ifdef SIGBUS - handle_signal ("BUS", SIGBUS); + parse_signal ("bus", SIGBUS); #endif #ifdef SIGSEGV - handle_signal ("SEGV", SIGSEGV); + parse_signal ("segv", SIGSEGV); #endif #ifdef SIGSYS - handle_signal ("SYS", SIGSYS); + parse_signal ("sys", SIGSYS); #endif #ifdef SIGPIPE - handle_signal ("PIPE", SIGPIPE); + parse_signal ("pipe", SIGPIPE); #endif #ifdef SIGALRM - handle_signal ("ALRM", SIGALRM); -#endif -#ifdef SIGTERM - handle_signal ("TERM", SIGTERM); + parse_signal ("alrm", SIGALRM); #endif #ifdef SIGURG - handle_signal ("URG", SIGURG); + parse_signal ("urg", SIGURG); #endif #ifdef SIGSTOP - handle_signal ("STOP", SIGSTOP); + parse_signal ("stop", SIGSTOP); #endif #ifdef SIGTSTP - handle_signal ("TSTP", SIGTSTP); + parse_signal ("tstp", SIGTSTP); #endif #ifdef SIGCONT - handle_signal ("CONT", SIGCONT); + parse_signal ("cont", SIGCONT); #endif #ifdef SIGCHLD - handle_signal ("CHLD", SIGCHLD); + parse_signal ("chld", SIGCHLD); #endif #ifdef SIGTTIN - handle_signal ("TTIN", SIGTTIN); + parse_signal ("ttin", SIGTTIN); #endif #ifdef SIGTTOU - handle_signal ("TTOU", SIGTTOU); + parse_signal ("ttou", SIGTTOU); #endif #ifdef SIGIO - handle_signal ("IO", SIGIO); + parse_signal ("io", SIGIO); #endif #ifdef SIGXCPU - handle_signal ("XCPU", SIGXCPU); + parse_signal ("xcpu", SIGXCPU); #endif #ifdef SIGXFSZ - handle_signal ("XFSZ", SIGXFSZ); + parse_signal ("xfsz", SIGXFSZ); #endif #ifdef SIGVTALRM - handle_signal ("VTALRM", SIGVTALRM); + parse_signal ("vtalrm", SIGVTALRM); #endif #ifdef SIGPROF - handle_signal ("PROF", SIGPROF); + parse_signal ("prof", SIGPROF); #endif #ifdef SIGWINCH - handle_signal ("WINCH", SIGWINCH); + parse_signal ("winch", SIGWINCH); #endif #ifdef SIGINFO - handle_signal ("INFO", SIGINFO); -#endif -#ifdef SIGUSR1 - handle_signal ("USR1", SIGUSR1); -#endif -#ifdef SIGUSR2 - handle_signal ("USR2", SIGUSR2); + parse_signal ("info", SIGINFO); #endif else error ("Undefined signal name %s", name); } -#undef handle_signal +#undef parse_signal return make_number (kill (pid, XINT (sigcode))); } |