aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/process.c b/src/process.c
index 8b1da4ac5cc..6d84d4c4a87 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;
@@ -3339,13 +3341,17 @@ usage: (make-network-process &rest ARGS) */)
3339#endif 3341#endif
3340 } 3342 }
3341 3343
3344 immediate_quit = 0;
3345
3342#ifdef HAVE_GETADDRINFO 3346#ifdef HAVE_GETADDRINFO
3343 if (res != &ai) 3347 if (res != &ai)
3344 freeaddrinfo (res); 3348 {
3349 BLOCK_INPUT;
3350 freeaddrinfo (res);
3351 UNBLOCK_INPUT;
3352 }
3345#endif 3353#endif
3346 3354
3347 immediate_quit = 0;
3348
3349 /* Discard the unwind protect for closing S, if any. */ 3355 /* Discard the unwind protect for closing S, if any. */
3350 specpdl_ptr = specpdl + count1; 3356 specpdl_ptr = specpdl + count1;
3351 3357
@@ -6491,7 +6497,7 @@ sigchld_handler (signo)
6491 6497
6492 while (1) 6498 while (1)
6493 { 6499 {
6494 register EMACS_INT pid; 6500 pid_t pid;
6495 WAITTYPE w; 6501 WAITTYPE w;
6496 Lisp_Object tail; 6502 Lisp_Object tail;
6497 6503
@@ -6500,12 +6506,17 @@ sigchld_handler (signo)
6500#define WUNTRACED 0 6506#define WUNTRACED 0
6501#endif /* no WUNTRACED */ 6507#endif /* no WUNTRACED */
6502 /* Keep trying to get a status until we get a definitive result. */ 6508 /* Keep trying to get a status until we get a definitive result. */
6503 do 6509 while (1)
6504 { 6510 {
6505 errno = 0; 6511 errno = 0;
6506 pid = wait3 (&w, WNOHANG | WUNTRACED, 0); 6512 pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
6513 if (! (pid < 0 && errno == EINTR))
6514 break;
6515 /* Avoid a busyloop: wait3 is a system call, so we do not want
6516 to prevent the kernel from actually sending SIGCHLD to emacs
6517 by asking for it all the time. */
6518 sleep (1);
6507 } 6519 }
6508 while (pid < 0 && errno == EINTR);
6509 6520
6510 if (pid <= 0) 6521 if (pid <= 0)
6511 { 6522 {
@@ -6531,11 +6542,15 @@ sigchld_handler (signo)
6531 /* Find the process that signaled us, and record its status. */ 6542 /* Find the process that signaled us, and record its status. */
6532 6543
6533 /* The process can have been deleted by Fdelete_process. */ 6544 /* The process can have been deleted by Fdelete_process. */
6534 tail = Fmember (make_fixnum_or_float (pid), deleted_pid_list); 6545 for (tail = deleted_pid_list; GC_CONSP (tail); tail = XCDR (tail))
6535 if (!NILP (tail))
6536 { 6546 {
6537 Fsetcar (tail, Qnil); 6547 Lisp_Object xpid = XCAR (tail);
6538 goto sigchld_end_of_loop; 6548 if ((GC_INTEGERP (xpid) && pid == (pid_t) XINT (xpid))
6549 || (GC_FLOATP (xpid) && pid == (pid_t) XFLOAT_DATA (xpid)))
6550 {
6551 XSETCAR (tail, Qnil);
6552 goto sigchld_end_of_loop;
6553 }
6539 } 6554 }
6540 6555
6541 /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */ 6556 /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */