aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorChong Yidong2007-03-17 18:24:46 +0000
committerChong Yidong2007-03-17 18:24:46 +0000
commit29ed4d512ba9e73343523528f99c1f6dc3d27e94 (patch)
tree8622f7f4963c17d0b4105c429134159055df6088 /src/process.c
parent8e050977ee78cb7cf2152fc56baf1cbd7a4afd6e (diff)
downloademacs-29ed4d512ba9e73343523528f99c1f6dc3d27e94.tar.gz
emacs-29ed4d512ba9e73343523528f99c1f6dc3d27e94.zip
(Fdelete_process): Properly handle deletion of first element of
deleted_pid_list. (create_process): Declare pid as pid_t. (sigchld_handler): Avoid busyloop.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/process.c b/src/process.c
index f6990c2ff19..0c9a9527c39 100644
--- a/src/process.c
+++ b/src/process.c
@@ -817,7 +817,7 @@ nil, indicating the current buffer's process. */)
817 Lisp_Object symbol; 817 Lisp_Object symbol;
818 /* Assignment to EMACS_INT stops GCC whining about limited range 818 /* Assignment to EMACS_INT stops GCC whining about limited range
819 of data type. */ 819 of data type. */
820 EMACS_INT pid = p->pid;; 820 EMACS_INT pid = p->pid;
821 821
822 /* No problem storing the pid here, as it is still in Vprocess_alist. */ 822 /* No problem storing the pid here, as it is still in Vprocess_alist. */
823 deleted_pid_list = Fcons (make_fixnum_or_float (pid), 823 deleted_pid_list = Fcons (make_fixnum_or_float (pid),
@@ -830,7 +830,8 @@ nil, indicating the current buffer's process. */)
830 if (CONSP (p->status)) 830 if (CONSP (p->status))
831 symbol = XCAR (p->status); 831 symbol = XCAR (p->status);
832 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)) 832 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit))
833 Fdelete (make_fixnum_or_float (pid), deleted_pid_list); 833 deleted_pid_list
834 = Fdelete (make_fixnum_or_float (pid), deleted_pid_list);
834 else 835 else
835#endif 836#endif
836 { 837 {
@@ -1818,7 +1819,8 @@ create_process (process, new_argv, current_dir)
1818 char **new_argv; 1819 char **new_argv;
1819 Lisp_Object current_dir; 1820 Lisp_Object current_dir;
1820{ 1821{
1821 int pid, inchannel, outchannel; 1822 int inchannel, outchannel;
1823 pid_t pid;
1822 int sv[2]; 1824 int sv[2];
1823#ifdef POSIX_SIGNALS 1825#ifdef POSIX_SIGNALS
1824 sigset_t procmask; 1826 sigset_t procmask;
@@ -6495,16 +6497,17 @@ sigchld_handler (signo)
6495#define WUNTRACED 0 6497#define WUNTRACED 0
6496#endif /* no WUNTRACED */ 6498#endif /* no WUNTRACED */
6497 /* Keep trying to get a status until we get a definitive result. */ 6499 /* Keep trying to get a status until we get a definitive result. */
6498 while (1) { 6500 while (1)
6499 errno = 0; 6501 {
6500 pid = wait3 (&w, WNOHANG | WUNTRACED, 0); 6502 errno = 0;
6501 if (! (pid < 0 && errno == EINTR)) 6503 pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
6502 break; 6504 if (! (pid < 0 && errno == EINTR))
6503 /* avoid a busyloop: wait3 is a system call, so we do not want 6505 break;
6504 to prevent the kernel from actually sending SIGCHLD to emacs 6506 /* Avoid a busyloop: wait3 is a system call, so we do not want
6505 by asking for it all the time */ 6507 to prevent the kernel from actually sending SIGCHLD to emacs
6506 sleep (1); 6508 by asking for it all the time. */
6507 } 6509 sleep (1);
6510 }
6508 6511
6509 if (pid <= 0) 6512 if (pid <= 0)
6510 { 6513 {