Mercurial > emacs
comparison src/process.c @ 1522:19ccf004b172
* process.c: (status_convert): Declare this to return a
Lisp_Object at the top of the file.
(decode_status): Don't untag XCONS (tem)->cdr before storing it in
tem; tem is a Lisp_Object, too.
(process_send_signal): Declare this to be static void. Don't
return Qnil; nobody cares.
(sigchld_handler): Use XFASTINT to manipulate p->infd.
* process.c (pty_process): Variable deleted; it's no longer used.
(syms_of_process): Don't initialize it.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Sat, 31 Oct 1992 05:27:42 +0000 |
| parents | 25b5b55a3916 |
| children | 52a69b6a8f96 |
comparison
equal
deleted
inserted
replaced
| 1521:5d58b9e933ee | 1522:19ccf004b172 |
|---|---|
| 282 int proc_buffered_char[MAXDESC]; | 282 int proc_buffered_char[MAXDESC]; |
| 283 | 283 |
| 284 /* Compute the Lisp form of the process status, p->status, from | 284 /* Compute the Lisp form of the process status, p->status, from |
| 285 the numeric status that was returned by `wait'. */ | 285 the numeric status that was returned by `wait'. */ |
| 286 | 286 |
| 287 Lisp_Object status_convert (); | |
| 288 | |
| 287 update_status (p) | 289 update_status (p) |
| 288 struct Lisp_Process *p; | 290 struct Lisp_Process *p; |
| 289 { | 291 { |
| 290 union { int i; WAITTYPE wt; } u; | 292 union { int i; WAITTYPE wt; } u; |
| 291 u.i = XFASTINT (p->raw_status_low) + (XFASTINT (p->raw_status_high) << 16); | 293 u.i = XFASTINT (p->raw_status_low) + (XFASTINT (p->raw_status_high) << 16); |
| 334 else | 336 else |
| 335 { | 337 { |
| 336 *symbol = XCONS (l)->car; | 338 *symbol = XCONS (l)->car; |
| 337 tem = XCONS (l)->cdr; | 339 tem = XCONS (l)->cdr; |
| 338 *code = XFASTINT (XCONS (tem)->car); | 340 *code = XFASTINT (XCONS (tem)->car); |
| 339 tem = XFASTINT (XCONS (tem)->cdr); | 341 tem = XCONS (tem)->cdr; |
| 340 *coredump = !NILP (tem); | 342 *coredump = !NILP (tem); |
| 341 } | 343 } |
| 342 } | 344 } |
| 343 | 345 |
| 344 /* Return a string describing a process status list. */ | 346 /* Return a string describing a process status list. */ |
| 372 else | 374 else |
| 373 return Fcopy_sequence (Fsymbol_name (symbol)); | 375 return Fcopy_sequence (Fsymbol_name (symbol)); |
| 374 } | 376 } |
| 375 | 377 |
| 376 #ifdef HAVE_PTYS | 378 #ifdef HAVE_PTYS |
| 377 static int pty_process; | |
| 378 | 379 |
| 379 /* Open an available pty, returning a file descriptor. | 380 /* Open an available pty, returning a file descriptor. |
| 380 Return -1 on failure. | 381 Return -1 on failure. |
| 381 The file name of the terminal corresponding to the pty | 382 The file name of the terminal corresponding to the pty |
| 382 is left in the variable pty_name. */ | 383 is left in the variable pty_name. */ |
| 2216 the terminal being used to communicate with PROCESS. | 2217 the terminal being used to communicate with PROCESS. |
| 2217 This is used for various commands in shell mode. | 2218 This is used for various commands in shell mode. |
| 2218 If NOMSG is zero, insert signal-announcements into process's buffers | 2219 If NOMSG is zero, insert signal-announcements into process's buffers |
| 2219 right away. */ | 2220 right away. */ |
| 2220 | 2221 |
| 2222 static void | |
| 2221 process_send_signal (process, signo, current_group, nomsg) | 2223 process_send_signal (process, signo, current_group, nomsg) |
| 2222 Lisp_Object process; | 2224 Lisp_Object process; |
| 2223 int signo; | 2225 int signo; |
| 2224 Lisp_Object current_group; | 2226 Lisp_Object current_group; |
| 2225 int nomsg; | 2227 int nomsg; |
| 2254 switch (signo) | 2256 switch (signo) |
| 2255 { | 2257 { |
| 2256 case SIGINT: | 2258 case SIGINT: |
| 2257 ioctl (XFASTINT (p->infd), TIOCGETC, &c); | 2259 ioctl (XFASTINT (p->infd), TIOCGETC, &c); |
| 2258 send_process (proc, &c.t_intrc, 1); | 2260 send_process (proc, &c.t_intrc, 1); |
| 2259 return Qnil; | 2261 return; |
| 2260 case SIGQUIT: | 2262 case SIGQUIT: |
| 2261 ioctl (XFASTINT (p->infd), TIOCGETC, &c); | 2263 ioctl (XFASTINT (p->infd), TIOCGETC, &c); |
| 2262 send_process (proc, &c.t_quitc, 1); | 2264 send_process (proc, &c.t_quitc, 1); |
| 2263 return Qnil; | 2265 return; |
| 2264 #ifdef SIGTSTP | 2266 #ifdef SIGTSTP |
| 2265 case SIGTSTP: | 2267 case SIGTSTP: |
| 2266 ioctl (XFASTINT (p->infd), TIOCGLTC, &lc); | 2268 ioctl (XFASTINT (p->infd), TIOCGLTC, &lc); |
| 2267 send_process (proc, &lc.t_suspc, 1); | 2269 send_process (proc, &lc.t_suspc, 1); |
| 2268 return Qnil; | 2270 return; |
| 2269 #endif /* SIGTSTP */ | 2271 #endif /* SIGTSTP */ |
| 2270 } | 2272 } |
| 2271 #endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ | 2273 #endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ |
| 2272 /* It is possible that the following code would work | 2274 /* It is possible that the following code would work |
| 2273 on other kinds of USG systems, not just on the IRIS. | 2275 on other kinds of USG systems, not just on the IRIS. |
| 2277 switch (signo) | 2279 switch (signo) |
| 2278 { | 2280 { |
| 2279 case SIGINT: | 2281 case SIGINT: |
| 2280 ioctl (XFASTINT (p->infd), TCGETA, &t); | 2282 ioctl (XFASTINT (p->infd), TCGETA, &t); |
| 2281 send_process (proc, &t.c_cc[VINTR], 1); | 2283 send_process (proc, &t.c_cc[VINTR], 1); |
| 2282 return Qnil; | 2284 return; |
| 2283 case SIGQUIT: | 2285 case SIGQUIT: |
| 2284 ioctl (XFASTINT (p->infd), TCGETA, &t); | 2286 ioctl (XFASTINT (p->infd), TCGETA, &t); |
| 2285 send_process (proc, &t.c_cc[VQUIT], 1); | 2287 send_process (proc, &t.c_cc[VQUIT], 1); |
| 2286 return Qnil; | 2288 return; |
| 2287 case SIGTSTP: | 2289 case SIGTSTP: |
| 2288 ioctl (XFASTINT (p->infd), TCGETA, &t); | 2290 ioctl (XFASTINT (p->infd), TCGETA, &t); |
| 2289 send_process (proc, &t.c_cc[VSWTCH], 1); | 2291 send_process (proc, &t.c_cc[VSWTCH], 1); |
| 2290 return Qnil; | 2292 return; |
| 2291 } | 2293 } |
| 2292 #endif /* ! defined (USG) */ | 2294 #endif /* ! defined (USG) */ |
| 2293 | 2295 |
| 2294 #ifdef TIOCGPGRP | 2296 #ifdef TIOCGPGRP |
| 2295 /* Get the pgrp using the tty itself, if we have that. | 2297 /* Get the pgrp using the tty itself, if we have that. |
| 2618 XFASTINT (p->raw_status_low) = u.i & 0xffff; | 2620 XFASTINT (p->raw_status_low) = u.i & 0xffff; |
| 2619 XFASTINT (p->raw_status_high) = u.i >> 16; | 2621 XFASTINT (p->raw_status_high) = u.i >> 16; |
| 2620 | 2622 |
| 2621 /* If process has terminated, stop waiting for its output. */ | 2623 /* If process has terminated, stop waiting for its output. */ |
| 2622 if (WIFSIGNALED (w) || WIFEXITED (w)) | 2624 if (WIFSIGNALED (w) || WIFEXITED (w)) |
| 2623 if (p->infd) | 2625 if (XFASTINT (p->infd)) |
| 2624 FD_CLR (p->infd, &input_wait_mask); | 2626 FD_CLR (XFASTINT (p->infd), &input_wait_mask); |
| 2625 } | 2627 } |
| 2626 | 2628 |
| 2627 /* There was no asynchronous process found for that id. Check | 2629 /* There was no asynchronous process found for that id. Check |
| 2628 if we have a synchronous process. */ | 2630 if we have a synchronous process. */ |
| 2629 else | 2631 else |
| 2818 return XPROCESS (process)->type; | 2820 return XPROCESS (process)->type; |
| 2819 } | 2821 } |
| 2820 #endif | 2822 #endif |
| 2821 syms_of_process () | 2823 syms_of_process () |
| 2822 { | 2824 { |
| 2823 #ifdef HAVE_PTYS | |
| 2824 pty_process = intern ("pty"); | |
| 2825 #endif | |
| 2826 #ifdef HAVE_SOCKETS | 2825 #ifdef HAVE_SOCKETS |
| 2827 stream_process = intern ("stream"); | 2826 stream_process = intern ("stream"); |
| 2828 #endif | 2827 #endif |
| 2829 Qprocessp = intern ("processp"); | 2828 Qprocessp = intern ("processp"); |
| 2830 staticpro (&Qprocessp); | 2829 staticpro (&Qprocessp); |
