diff options
| author | Kim F. Storm | 2005-08-15 08:44:53 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-08-15 08:44:53 +0000 |
| commit | ff6daed30415db8a1110e11f67f5d61ef02f04a5 (patch) | |
| tree | a3b5f752751fa59477946405b2fc1e462bfb351d /src | |
| parent | 71e37f3cf25f14f87c581bf139a26fa8b6915aca (diff) | |
| download | emacs-ff6daed30415db8a1110e11f67f5d61ef02f04a5.tar.gz emacs-ff6daed30415db8a1110e11f67f5d61ef02f04a5.zip | |
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/src/process.c b/src/process.c index c683e7b8516..18a446e9561 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -294,7 +294,10 @@ static Lisp_Object Vprocess_adaptive_read_buffering; | |||
| 294 | 294 | ||
| 295 | #include "sysselect.h" | 295 | #include "sysselect.h" |
| 296 | 296 | ||
| 297 | extern int keyboard_bit_set P_ ((SELECT_TYPE *)); | 297 | static int keyboard_bit_set P_ ((SELECT_TYPE *)); |
| 298 | static void deactivate_process P_ ((Lisp_Object)); | ||
| 299 | static void status_notify P_ ((struct Lisp_Process *)); | ||
| 300 | static int read_process_output P_ ((Lisp_Object, int)); | ||
| 298 | 301 | ||
| 299 | /* If we support a window system, turn on the code to poll periodically | 302 | /* If we support a window system, turn on the code to poll periodically |
| 300 | to detect C-g. It isn't actually used when doing interrupt input. */ | 303 | to detect C-g. It isn't actually used when doing interrupt input. */ |
| @@ -391,9 +394,9 @@ static char pty_name[24]; | |||
| 391 | /* Compute the Lisp form of the process status, p->status, from | 394 | /* Compute the Lisp form of the process status, p->status, from |
| 392 | the numeric status that was returned by `wait'. */ | 395 | the numeric status that was returned by `wait'. */ |
| 393 | 396 | ||
| 394 | Lisp_Object status_convert (); | 397 | static Lisp_Object status_convert (); |
| 395 | 398 | ||
| 396 | void | 399 | static void |
| 397 | update_status (p) | 400 | update_status (p) |
| 398 | struct Lisp_Process *p; | 401 | struct Lisp_Process *p; |
| 399 | { | 402 | { |
| @@ -407,7 +410,7 @@ update_status (p) | |||
| 407 | /* Convert a process status word in Unix format to | 410 | /* Convert a process status word in Unix format to |
| 408 | the list that we use internally. */ | 411 | the list that we use internally. */ |
| 409 | 412 | ||
| 410 | Lisp_Object | 413 | static Lisp_Object |
| 411 | status_convert (w) | 414 | status_convert (w) |
| 412 | WAITTYPE w; | 415 | WAITTYPE w; |
| 413 | { | 416 | { |
| @@ -426,7 +429,7 @@ status_convert (w) | |||
| 426 | /* Given a status-list, extract the three pieces of information | 429 | /* Given a status-list, extract the three pieces of information |
| 427 | and store them individually through the three pointers. */ | 430 | and store them individually through the three pointers. */ |
| 428 | 431 | ||
| 429 | void | 432 | static void |
| 430 | decode_status (l, symbol, code, coredump) | 433 | decode_status (l, symbol, code, coredump) |
| 431 | Lisp_Object l; | 434 | Lisp_Object l; |
| 432 | Lisp_Object *symbol; | 435 | Lisp_Object *symbol; |
| @@ -505,7 +508,7 @@ status_message (p) | |||
| 505 | The file name of the terminal corresponding to the pty | 508 | The file name of the terminal corresponding to the pty |
| 506 | is left in the variable pty_name. */ | 509 | is left in the variable pty_name. */ |
| 507 | 510 | ||
| 508 | int | 511 | static int |
| 509 | allocate_pty () | 512 | allocate_pty () |
| 510 | { | 513 | { |
| 511 | register int c, i; | 514 | register int c, i; |
| @@ -590,7 +593,7 @@ allocate_pty () | |||
| 590 | } | 593 | } |
| 591 | #endif /* HAVE_PTYS */ | 594 | #endif /* HAVE_PTYS */ |
| 592 | 595 | ||
| 593 | Lisp_Object | 596 | static Lisp_Object |
| 594 | make_process (name) | 597 | make_process (name) |
| 595 | Lisp_Object name; | 598 | Lisp_Object name; |
| 596 | { | 599 | { |
| @@ -634,7 +637,7 @@ make_process (name) | |||
| 634 | return val; | 637 | return val; |
| 635 | } | 638 | } |
| 636 | 639 | ||
| 637 | void | 640 | static void |
| 638 | remove_process (proc) | 641 | remove_process (proc) |
| 639 | register Lisp_Object proc; | 642 | register Lisp_Object proc; |
| 640 | { | 643 | { |
| @@ -768,23 +771,27 @@ nil, indicating the current buffer's process. */) | |||
| 768 | (process) | 771 | (process) |
| 769 | register Lisp_Object process; | 772 | register Lisp_Object process; |
| 770 | { | 773 | { |
| 774 | register struct Lisp_Process *p; | ||
| 775 | |||
| 771 | process = get_process (process); | 776 | process = get_process (process); |
| 772 | XPROCESS (process)->raw_status_low = Qnil; | 777 | p = XPROCESS (process); |
| 773 | XPROCESS (process)->raw_status_high = Qnil; | 778 | |
| 774 | if (NETCONN_P (process)) | 779 | p->raw_status_low = Qnil; |
| 780 | p->raw_status_high = Qnil; | ||
| 781 | if (NETCONN1_P (p)) | ||
| 775 | { | 782 | { |
| 776 | XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); | 783 | p->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); |
| 777 | XSETINT (XPROCESS (process)->tick, ++process_tick); | 784 | XSETINT (p->tick, ++process_tick); |
| 778 | status_notify (); | 785 | status_notify (p); |
| 779 | } | 786 | } |
| 780 | else if (XINT (XPROCESS (process)->infd) >= 0) | 787 | else if (XINT (p->infd) >= 0) |
| 781 | { | 788 | { |
| 782 | Fkill_process (process, Qnil); | 789 | Fkill_process (process, Qnil); |
| 783 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | 790 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ |
| 784 | XPROCESS (process)->status | 791 | p->status |
| 785 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | 792 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); |
| 786 | XSETINT (XPROCESS (process)->tick, ++process_tick); | 793 | XSETINT (p->tick, ++process_tick); |
| 787 | status_notify (); | 794 | status_notify (p); |
| 788 | } | 795 | } |
| 789 | remove_process (process); | 796 | remove_process (process); |
| 790 | return Qnil; | 797 | return Qnil; |
| @@ -1238,7 +1245,7 @@ IP address. Returns nil if format of ADDRESS is invalid. */) | |||
| 1238 | } | 1245 | } |
| 1239 | #endif | 1246 | #endif |
| 1240 | 1247 | ||
| 1241 | Lisp_Object | 1248 | static Lisp_Object |
| 1242 | list_processes_1 (query_only) | 1249 | list_processes_1 (query_only) |
| 1243 | Lisp_Object query_only; | 1250 | Lisp_Object query_only; |
| 1244 | { | 1251 | { |
| @@ -1708,7 +1715,7 @@ start_process_unwind (proc) | |||
| 1708 | return Qnil; | 1715 | return Qnil; |
| 1709 | } | 1716 | } |
| 1710 | 1717 | ||
| 1711 | void | 1718 | static void |
| 1712 | create_process_1 (timer) | 1719 | create_process_1 (timer) |
| 1713 | struct atimer *timer; | 1720 | struct atimer *timer; |
| 1714 | { | 1721 | { |
| @@ -2531,7 +2538,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */) | |||
| 2531 | 2538 | ||
| 2532 | /* A version of request_sigio suitable for a record_unwind_protect. */ | 2539 | /* A version of request_sigio suitable for a record_unwind_protect. */ |
| 2533 | 2540 | ||
| 2534 | Lisp_Object | 2541 | static Lisp_Object |
| 2535 | unwind_request_sigio (dummy) | 2542 | unwind_request_sigio (dummy) |
| 2536 | Lisp_Object dummy; | 2543 | Lisp_Object dummy; |
| 2537 | { | 2544 | { |
| @@ -4222,7 +4229,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4222 | /* It's okay for us to do this and then continue with | 4229 | /* It's okay for us to do this and then continue with |
| 4223 | the loop, since timeout has already been zeroed out. */ | 4230 | the loop, since timeout has already been zeroed out. */ |
| 4224 | clear_waiting_for_input (); | 4231 | clear_waiting_for_input (); |
| 4225 | status_notify (); | 4232 | status_notify (NULL); |
| 4226 | } | 4233 | } |
| 4227 | } | 4234 | } |
| 4228 | 4235 | ||
| @@ -4740,7 +4747,7 @@ read_process_output_error_handler (error) | |||
| 4740 | The characters read are decoded according to PROC's coding-system | 4747 | The characters read are decoded according to PROC's coding-system |
| 4741 | for decoding. */ | 4748 | for decoding. */ |
| 4742 | 4749 | ||
| 4743 | int | 4750 | static int |
| 4744 | read_process_output (proc, channel) | 4751 | read_process_output (proc, channel) |
| 4745 | Lisp_Object proc; | 4752 | Lisp_Object proc; |
| 4746 | register int channel; | 4753 | register int channel; |
| @@ -5131,7 +5138,7 @@ send_process_trap () | |||
| 5131 | 5138 | ||
| 5132 | This function can evaluate Lisp code and can garbage collect. */ | 5139 | This function can evaluate Lisp code and can garbage collect. */ |
| 5133 | 5140 | ||
| 5134 | void | 5141 | static void |
| 5135 | send_process (proc, buf, len, object) | 5142 | send_process (proc, buf, len, object) |
| 5136 | volatile Lisp_Object proc; | 5143 | volatile Lisp_Object proc; |
| 5137 | unsigned char *volatile buf; | 5144 | unsigned char *volatile buf; |
| @@ -5725,7 +5732,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 5725 | p->status = Qrun; | 5732 | p->status = Qrun; |
| 5726 | XSETINT (p->tick, ++process_tick); | 5733 | XSETINT (p->tick, ++process_tick); |
| 5727 | if (!nomsg) | 5734 | if (!nomsg) |
| 5728 | status_notify (); | 5735 | status_notify (NULL); |
| 5729 | break; | 5736 | break; |
| 5730 | #endif /* ! defined (SIGCONT) */ | 5737 | #endif /* ! defined (SIGCONT) */ |
| 5731 | case SIGINT: | 5738 | case SIGINT: |
| @@ -6393,8 +6400,9 @@ exec_sentinel (proc, reason) | |||
| 6393 | This is usually done while Emacs is waiting for keyboard input | 6400 | This is usually done while Emacs is waiting for keyboard input |
| 6394 | but can be done at other times. */ | 6401 | but can be done at other times. */ |
| 6395 | 6402 | ||
| 6396 | void | 6403 | static void |
| 6397 | status_notify () | 6404 | status_notify (deleting_process) |
| 6405 | struct Lisp_Process *deleting_process; | ||
| 6398 | { | 6406 | { |
| 6399 | register Lisp_Object proc, buffer; | 6407 | register Lisp_Object proc, buffer; |
| 6400 | Lisp_Object tail, msg; | 6408 | Lisp_Object tail, msg; |
| @@ -6430,6 +6438,7 @@ status_notify () | |||
| 6430 | && ! EQ (p->status, Qlisten) | 6438 | && ! EQ (p->status, Qlisten) |
| 6431 | && ! EQ (p->command, Qt) /* Network process not stopped. */ | 6439 | && ! EQ (p->command, Qt) /* Network process not stopped. */ |
| 6432 | && XINT (p->infd) >= 0 | 6440 | && XINT (p->infd) >= 0 |
| 6441 | && p != deleting_process | ||
| 6433 | && read_process_output (proc, XINT (p->infd)) > 0); | 6442 | && read_process_output (proc, XINT (p->infd)) > 0); |
| 6434 | 6443 | ||
| 6435 | buffer = p->buffer; | 6444 | buffer = p->buffer; |
| @@ -6633,7 +6642,7 @@ delete_keyboard_wait_descriptor (desc) | |||
| 6633 | /* Return nonzero if *MASK has a bit set | 6642 | /* Return nonzero if *MASK has a bit set |
| 6634 | that corresponds to one of the keyboard input descriptors. */ | 6643 | that corresponds to one of the keyboard input descriptors. */ |
| 6635 | 6644 | ||
| 6636 | int | 6645 | static int |
| 6637 | keyboard_bit_set (mask) | 6646 | keyboard_bit_set (mask) |
| 6638 | SELECT_TYPE *mask; | 6647 | SELECT_TYPE *mask; |
| 6639 | { | 6648 | { |