diff options
| author | Miles Bader | 2006-06-07 18:05:10 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-06-07 18:05:10 +0000 |
| commit | b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb (patch) | |
| tree | de3804210a8cd955e0d3b9abc15679480930bc82 /src/process.c | |
| parent | 885b7d0991bd4b4b8f4bd1d3cd21c18a697bbce2 (diff) | |
| parent | 26c9afc3239e18b03537faaea33e3e82e28099e6 (diff) | |
| download | emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.tar.gz emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 285-296)
- Update from CVS
- Merge from gnus--rel--5.10
- Update from CVS: admin/FOR-RELEASE: Update refcard section.
* gnus--rel--5.10 (patch 102-104)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 84 |
1 files changed, 76 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c index 1960e6a914c..2281f1ce3f6 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -777,6 +777,16 @@ get_process (name) | |||
| 777 | return proc; | 777 | return proc; |
| 778 | } | 778 | } |
| 779 | 779 | ||
| 780 | |||
| 781 | #ifdef SIGCHLD | ||
| 782 | /* Fdelete_process promises to immediately forget about the process, but in | ||
| 783 | reality, Emacs needs to remember those processes until they have been | ||
| 784 | treated by sigchld_handler; otherwise this handler would consider the | ||
| 785 | process as being synchronous and say that the synchronous process is | ||
| 786 | dead. */ | ||
| 787 | static Lisp_Object deleted_pid_list; | ||
| 788 | #endif | ||
| 789 | |||
| 780 | DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, | 790 | DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, |
| 781 | doc: /* Delete PROCESS: kill it and forget about it immediately. | 791 | doc: /* Delete PROCESS: kill it and forget about it immediately. |
| 782 | PROCESS may be a process, a buffer, the name of a process or buffer, or | 792 | PROCESS may be a process, a buffer, the name of a process or buffer, or |
| @@ -798,12 +808,31 @@ nil, indicating the current buffer's process. */) | |||
| 798 | } | 808 | } |
| 799 | else if (XINT (p->infd) >= 0) | 809 | else if (XINT (p->infd) >= 0) |
| 800 | { | 810 | { |
| 801 | Fkill_process (process, Qnil); | 811 | #ifdef SIGCHLD |
| 802 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | 812 | Lisp_Object symbol; |
| 803 | p->status | 813 | |
| 804 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | 814 | /* No problem storing the pid here, as it is still in Vprocess_alist. */ |
| 805 | XSETINT (p->tick, ++process_tick); | 815 | deleted_pid_list = Fcons (make_fixnum_or_float (p->pid), |
| 806 | status_notify (p); | 816 | /* GC treated elements set to nil. */ |
| 817 | Fdelq (Qnil, deleted_pid_list)); | ||
| 818 | /* If the process has already signaled, remove it from the list. */ | ||
| 819 | if (p->raw_status_new) | ||
| 820 | update_status (p); | ||
| 821 | symbol = p->status; | ||
| 822 | if (CONSP (p->status)) | ||
| 823 | symbol = XCAR (p->status); | ||
| 824 | if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)) | ||
| 825 | Fdelete (make_fixnum_or_float (p->pid), deleted_pid_list); | ||
| 826 | else | ||
| 827 | #endif | ||
| 828 | { | ||
| 829 | Fkill_process (process, Qnil); | ||
| 830 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | ||
| 831 | p->status | ||
| 832 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | ||
| 833 | XSETINT (p->tick, ++process_tick); | ||
| 834 | status_notify (p); | ||
| 835 | } | ||
| 807 | } | 836 | } |
| 808 | remove_process (process); | 837 | remove_process (process); |
| 809 | return Qnil; | 838 | return Qnil; |
| @@ -4134,6 +4163,25 @@ wait_reading_process_output_1 () | |||
| 4134 | { | 4163 | { |
| 4135 | } | 4164 | } |
| 4136 | 4165 | ||
| 4166 | /* Use a wrapper around select to work around a bug in gdb 5.3. | ||
| 4167 | Normally, the wrapper is optimzed away by inlining. | ||
| 4168 | |||
| 4169 | If emacs is stopped inside select, the gdb backtrace doesn't | ||
| 4170 | show the function which called select, so it is practically | ||
| 4171 | impossible to step through wait_reading_process_output. */ | ||
| 4172 | |||
| 4173 | #ifndef select | ||
| 4174 | static INLINE int | ||
| 4175 | select_wrapper (n, rfd, wfd, xfd, tmo) | ||
| 4176 | int n; | ||
| 4177 | SELECT_TYPE *rfd, *wfd, *xfd; | ||
| 4178 | EMACS_TIME *tmo; | ||
| 4179 | { | ||
| 4180 | return select (n, rfd, wfd, xfd, tmo); | ||
| 4181 | } | ||
| 4182 | #define select select_wrapper | ||
| 4183 | #endif | ||
| 4184 | |||
| 4137 | /* Read and dispose of subprocess output while waiting for timeout to | 4185 | /* Read and dispose of subprocess output while waiting for timeout to |
| 4138 | elapse and/or keyboard input to be available. | 4186 | elapse and/or keyboard input to be available. |
| 4139 | 4187 | ||
| @@ -6304,6 +6352,7 @@ kill_buffer_processes (buffer) | |||
| 6304 | ** Malloc WARNING: This should never call malloc either directly or | 6352 | ** Malloc WARNING: This should never call malloc either directly or |
| 6305 | indirectly; if it does, that is a bug */ | 6353 | indirectly; if it does, that is a bug */ |
| 6306 | 6354 | ||
| 6355 | #ifdef SIGCHLD | ||
| 6307 | SIGTYPE | 6356 | SIGTYPE |
| 6308 | sigchld_handler (signo) | 6357 | sigchld_handler (signo) |
| 6309 | int signo; | 6358 | int signo; |
| @@ -6361,6 +6410,15 @@ sigchld_handler (signo) | |||
| 6361 | 6410 | ||
| 6362 | /* Find the process that signaled us, and record its status. */ | 6411 | /* Find the process that signaled us, and record its status. */ |
| 6363 | 6412 | ||
| 6413 | /* The process can have been deleted by Fdelete_process. */ | ||
| 6414 | tail = Fmember (make_fixnum_or_float (pid), deleted_pid_list); | ||
| 6415 | if (!NILP (tail)) | ||
| 6416 | { | ||
| 6417 | Fsetcar (tail, Qnil); | ||
| 6418 | goto sigchld_end_of_loop; | ||
| 6419 | } | ||
| 6420 | |||
| 6421 | /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */ | ||
| 6364 | p = 0; | 6422 | p = 0; |
| 6365 | for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail)) | 6423 | for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail)) |
| 6366 | { | 6424 | { |
| @@ -6412,8 +6470,8 @@ sigchld_handler (signo) | |||
| 6412 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6470 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6413 | } | 6471 | } |
| 6414 | 6472 | ||
| 6415 | /* There was no asynchronous process found for that id. Check | 6473 | /* There was no asynchronous process found for that pid: we have |
| 6416 | if we have a synchronous process. */ | 6474 | a synchronous process. */ |
| 6417 | else | 6475 | else |
| 6418 | { | 6476 | { |
| 6419 | synch_process_alive = 0; | 6477 | synch_process_alive = 0; |
| @@ -6430,6 +6488,9 @@ sigchld_handler (signo) | |||
| 6430 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6488 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6431 | } | 6489 | } |
| 6432 | 6490 | ||
| 6491 | sigchld_end_of_loop: | ||
| 6492 | ; | ||
| 6493 | |||
| 6433 | /* On some systems, we must return right away. | 6494 | /* On some systems, we must return right away. |
| 6434 | If any more processes want to signal us, we will | 6495 | If any more processes want to signal us, we will |
| 6435 | get another signal. | 6496 | get another signal. |
| @@ -6446,6 +6507,7 @@ sigchld_handler (signo) | |||
| 6446 | #endif /* USG, but not HPUX with WNOHANG */ | 6507 | #endif /* USG, but not HPUX with WNOHANG */ |
| 6447 | } | 6508 | } |
| 6448 | } | 6509 | } |
| 6510 | #endif /* SIGCHLD */ | ||
| 6449 | 6511 | ||
| 6450 | 6512 | ||
| 6451 | static Lisp_Object | 6513 | static Lisp_Object |
| @@ -6831,6 +6893,9 @@ init_process () | |||
| 6831 | FD_SET (0, &input_wait_mask); | 6893 | FD_SET (0, &input_wait_mask); |
| 6832 | 6894 | ||
| 6833 | Vprocess_alist = Qnil; | 6895 | Vprocess_alist = Qnil; |
| 6896 | #ifdef SIGCHLD | ||
| 6897 | deleted_pid_list = Qnil; | ||
| 6898 | #endif | ||
| 6834 | for (i = 0; i < MAXDESC; i++) | 6899 | for (i = 0; i < MAXDESC; i++) |
| 6835 | { | 6900 | { |
| 6836 | chan_process[i] = Qnil; | 6901 | chan_process[i] = Qnil; |
| @@ -6969,6 +7034,9 @@ syms_of_process () | |||
| 6969 | staticpro (&Qlast_nonmenu_event); | 7034 | staticpro (&Qlast_nonmenu_event); |
| 6970 | 7035 | ||
| 6971 | staticpro (&Vprocess_alist); | 7036 | staticpro (&Vprocess_alist); |
| 7037 | #ifdef SIGCHLD | ||
| 7038 | staticpro (&deleted_pid_list); | ||
| 7039 | #endif | ||
| 6972 | 7040 | ||
| 6973 | DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, | 7041 | DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, |
| 6974 | doc: /* *Non-nil means delete processes immediately when they exit. | 7042 | doc: /* *Non-nil means delete processes immediately when they exit. |