aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c93
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) */)
2900 /* Make QCaddress an alias for :local (server) or :remote (client). */ 2900 /* Make QCaddress an alias for :local (server) or :remote (client). */
2901 QCaddress = is_server ? QClocal : QCremote; 2901 QCaddress = is_server ? QClocal : QCremote;
2902 2902
2903 /* :wait BOOL */ 2903 /* :nowait BOOL */
2904 if (!is_server && socktype == SOCK_STREAM 2904 if (!is_server && socktype == SOCK_STREAM
2905 && (tem = Fplist_get (contact, QCnowait), !NILP (tem))) 2905 && (tem = Fplist_get (contact, QCnowait), !NILP (tem)))
2906 { 2906 {
@@ -5144,6 +5144,9 @@ read_process_output (proc, channel)
5144 } 5144 }
5145 5145
5146 carryover = nbytes - coding->consumed; 5146 carryover = nbytes - coding->consumed;
5147 if (carryover < 0)
5148 abort ();
5149
5147 if (SCHARS (p->decoding_buf) < carryover) 5150 if (SCHARS (p->decoding_buf) < carryover)
5148 p->decoding_buf = make_uninit_string (carryover); 5151 p->decoding_buf = make_uninit_string (carryover);
5149 bcopy (chars + coding->consumed, SDATA (p->decoding_buf), 5152 bcopy (chars + coding->consumed, SDATA (p->decoding_buf),
@@ -5254,11 +5257,15 @@ read_process_output (proc, channel)
5254 } 5257 }
5255 } 5258 }
5256 carryover = nbytes - coding->consumed; 5259 carryover = nbytes - coding->consumed;
5260 if (carryover < 0)
5261 abort ();
5262
5257 if (SCHARS (p->decoding_buf) < carryover) 5263 if (SCHARS (p->decoding_buf) < carryover)
5258 p->decoding_buf = make_uninit_string (carryover); 5264 p->decoding_buf = make_uninit_string (carryover);
5259 bcopy (chars + coding->consumed, SDATA (p->decoding_buf), 5265 bcopy (chars + coding->consumed, SDATA (p->decoding_buf),
5260 carryover); 5266 carryover);
5261 XSETINT (p->decoding_carryover, carryover); 5267 XSETINT (p->decoding_carryover, carryover);
5268
5262 /* Adjust the multibyteness of TEXT to that of the buffer. */ 5269 /* Adjust the multibyteness of TEXT to that of the buffer. */
5263 if (NILP (current_buffer->enable_multibyte_characters) 5270 if (NILP (current_buffer->enable_multibyte_characters)
5264 != ! STRING_MULTIBYTE (text)) 5271 != ! STRING_MULTIBYTE (text))
@@ -6099,7 +6106,7 @@ If PROCESS is a network process, resume handling of incoming traffic. */)
6099DEFUN ("signal-process", Fsignal_process, Ssignal_process, 6106DEFUN ("signal-process", Fsignal_process, Ssignal_process,
6100 2, 2, "sProcess (name or number): \nnSignal code: ", 6107 2, 2, "sProcess (name or number): \nnSignal code: ",
6101 doc: /* Send PROCESS the signal with code SIGCODE. 6108 doc: /* Send PROCESS the signal with code SIGCODE.
6102PROCESS may also be an integer specifying the process id of the 6109PROCESS may also be a number specifying the process id of the
6103process to signal; in this case, the process need not be a child of 6110process to signal; in this case, the process need not be a child of
6104this Emacs. 6111this Emacs.
6105SIGCODE may be an integer, or a symbol whose name is a signal name. */) 6112SIGCODE 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. */)
6116 6123
6117 if (FLOATP (process)) 6124 if (FLOATP (process))
6118 { 6125 {
6119 pid = (pid_t) XFLOAT (process); 6126 pid = (pid_t) XFLOAT_DATA (process);
6120 goto got_it; 6127 goto got_it;
6121 } 6128 }
6122 6129
@@ -6144,8 +6151,8 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6144 6151
6145 got_it: 6152 got_it:
6146 6153
6147#define handle_signal(NAME, VALUE) \ 6154#define parse_signal(NAME, VALUE) \
6148 else if (!strcmp (name, NAME)) \ 6155 else if (!xstricmp (name, NAME)) \
6149 XSETINT (sigcode, VALUE) 6156 XSETINT (sigcode, VALUE)
6150 6157
6151 if (INTEGERP (sigcode)) 6158 if (INTEGERP (sigcode))
@@ -6157,106 +6164,106 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6157 CHECK_SYMBOL (sigcode); 6164 CHECK_SYMBOL (sigcode);
6158 name = SDATA (SYMBOL_NAME (sigcode)); 6165 name = SDATA (SYMBOL_NAME (sigcode));
6159 6166
6160 if (!strncmp(name, "SIG", 3)) 6167 if (!strncmp(name, "SIG", 3) || !strncmp(name, "sig", 3))
6161 name += 3; 6168 name += 3;
6162 6169
6163 if (0) 6170 if (0)
6164 ; 6171 ;
6172#ifdef SIGUSR1
6173 parse_signal ("usr1", SIGUSR1);
6174#endif
6175#ifdef SIGUSR2
6176 parse_signal ("usr2", SIGUSR2);
6177#endif
6178#ifdef SIGTERM
6179 parse_signal ("term", SIGTERM);
6180#endif
6165#ifdef SIGHUP 6181#ifdef SIGHUP
6166 handle_signal ("HUP", SIGHUP); 6182 parse_signal ("hup", SIGHUP);
6167#endif 6183#endif
6168#ifdef SIGINT 6184#ifdef SIGINT
6169 handle_signal ("INT", SIGINT); 6185 parse_signal ("int", SIGINT);
6170#endif 6186#endif
6171#ifdef SIGQUIT 6187#ifdef SIGQUIT
6172 handle_signal ("QUIT", SIGQUIT); 6188 parse_signal ("quit", SIGQUIT);
6173#endif 6189#endif
6174#ifdef SIGILL 6190#ifdef SIGILL
6175 handle_signal ("ILL", SIGILL); 6191 parse_signal ("ill", SIGILL);
6176#endif 6192#endif
6177#ifdef SIGABRT 6193#ifdef SIGABRT
6178 handle_signal ("ABRT", SIGABRT); 6194 parse_signal ("abrt", SIGABRT);
6179#endif 6195#endif
6180#ifdef SIGEMT 6196#ifdef SIGEMT
6181 handle_signal ("EMT", SIGEMT); 6197 parse_signal ("emt", SIGEMT);
6182#endif 6198#endif
6183#ifdef SIGKILL 6199#ifdef SIGKILL
6184 handle_signal ("KILL", SIGKILL); 6200 parse_signal ("kill", SIGKILL);
6185#endif 6201#endif
6186#ifdef SIGFPE 6202#ifdef SIGFPE
6187 handle_signal ("FPE", SIGFPE); 6203 parse_signal ("fpe", SIGFPE);
6188#endif 6204#endif
6189#ifdef SIGBUS 6205#ifdef SIGBUS
6190 handle_signal ("BUS", SIGBUS); 6206 parse_signal ("bus", SIGBUS);
6191#endif 6207#endif
6192#ifdef SIGSEGV 6208#ifdef SIGSEGV
6193 handle_signal ("SEGV", SIGSEGV); 6209 parse_signal ("segv", SIGSEGV);
6194#endif 6210#endif
6195#ifdef SIGSYS 6211#ifdef SIGSYS
6196 handle_signal ("SYS", SIGSYS); 6212 parse_signal ("sys", SIGSYS);
6197#endif 6213#endif
6198#ifdef SIGPIPE 6214#ifdef SIGPIPE
6199 handle_signal ("PIPE", SIGPIPE); 6215 parse_signal ("pipe", SIGPIPE);
6200#endif 6216#endif
6201#ifdef SIGALRM 6217#ifdef SIGALRM
6202 handle_signal ("ALRM", SIGALRM); 6218 parse_signal ("alrm", SIGALRM);
6203#endif
6204#ifdef SIGTERM
6205 handle_signal ("TERM", SIGTERM);
6206#endif 6219#endif
6207#ifdef SIGURG 6220#ifdef SIGURG
6208 handle_signal ("URG", SIGURG); 6221 parse_signal ("urg", SIGURG);
6209#endif 6222#endif
6210#ifdef SIGSTOP 6223#ifdef SIGSTOP
6211 handle_signal ("STOP", SIGSTOP); 6224 parse_signal ("stop", SIGSTOP);
6212#endif 6225#endif
6213#ifdef SIGTSTP 6226#ifdef SIGTSTP
6214 handle_signal ("TSTP", SIGTSTP); 6227 parse_signal ("tstp", SIGTSTP);
6215#endif 6228#endif
6216#ifdef SIGCONT 6229#ifdef SIGCONT
6217 handle_signal ("CONT", SIGCONT); 6230 parse_signal ("cont", SIGCONT);
6218#endif 6231#endif
6219#ifdef SIGCHLD 6232#ifdef SIGCHLD
6220 handle_signal ("CHLD", SIGCHLD); 6233 parse_signal ("chld", SIGCHLD);
6221#endif 6234#endif
6222#ifdef SIGTTIN 6235#ifdef SIGTTIN
6223 handle_signal ("TTIN", SIGTTIN); 6236 parse_signal ("ttin", SIGTTIN);
6224#endif 6237#endif
6225#ifdef SIGTTOU 6238#ifdef SIGTTOU
6226 handle_signal ("TTOU", SIGTTOU); 6239 parse_signal ("ttou", SIGTTOU);
6227#endif 6240#endif
6228#ifdef SIGIO 6241#ifdef SIGIO
6229 handle_signal ("IO", SIGIO); 6242 parse_signal ("io", SIGIO);
6230#endif 6243#endif
6231#ifdef SIGXCPU 6244#ifdef SIGXCPU
6232 handle_signal ("XCPU", SIGXCPU); 6245 parse_signal ("xcpu", SIGXCPU);
6233#endif 6246#endif
6234#ifdef SIGXFSZ 6247#ifdef SIGXFSZ
6235 handle_signal ("XFSZ", SIGXFSZ); 6248 parse_signal ("xfsz", SIGXFSZ);
6236#endif 6249#endif
6237#ifdef SIGVTALRM 6250#ifdef SIGVTALRM
6238 handle_signal ("VTALRM", SIGVTALRM); 6251 parse_signal ("vtalrm", SIGVTALRM);
6239#endif 6252#endif
6240#ifdef SIGPROF 6253#ifdef SIGPROF
6241 handle_signal ("PROF", SIGPROF); 6254 parse_signal ("prof", SIGPROF);
6242#endif 6255#endif
6243#ifdef SIGWINCH 6256#ifdef SIGWINCH
6244 handle_signal ("WINCH", SIGWINCH); 6257 parse_signal ("winch", SIGWINCH);
6245#endif 6258#endif
6246#ifdef SIGINFO 6259#ifdef SIGINFO
6247 handle_signal ("INFO", SIGINFO); 6260 parse_signal ("info", SIGINFO);
6248#endif
6249#ifdef SIGUSR1
6250 handle_signal ("USR1", SIGUSR1);
6251#endif
6252#ifdef SIGUSR2
6253 handle_signal ("USR2", SIGUSR2);
6254#endif 6261#endif
6255 else 6262 else
6256 error ("Undefined signal name %s", name); 6263 error ("Undefined signal name %s", name);
6257 } 6264 }
6258 6265
6259#undef handle_signal 6266#undef parse_signal
6260 6267
6261 return make_number (kill (pid, XINT (sigcode))); 6268 return make_number (kill (pid, XINT (sigcode)));
6262} 6269}