summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorKaroly Lorentey <karoly@lorentey.hu>2007-04-22 12:12:29 +0000
committerKaroly Lorentey <karoly@lorentey.hu>2007-04-22 12:12:29 +0000
commite18c709364b095ea0be8ecabe458ac9a642a252f (patch)
treeefe814a842f932f387b3947c572bf43a548d17ef /src/process.c
parent81088e260b086fe28f36964f32b6338210ec6fd8 (diff)
parent9f25e707aaad5ed14a9448e9c5d345ff0bdbc5a7 (diff)
downloademacs-e18c709364b095ea0be8ecabe458ac9a642a252f.tar.gz
emacs-e18c709364b095ea0be8ecabe458ac9a642a252f.tar.bz2
emacs-e18c709364b095ea0be8ecabe458ac9a642a252f.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-660 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-661 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-662 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-663 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-664 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-665 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-666 Fix read-only prompt problem in isearch * emacs@sv.gnu.org/emacs--devo--0--patch-667 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-668 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-669 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-670 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-671 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-672 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-673 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-206 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-207 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-208 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-600
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. */)
Lisp_Object symbol;
/* Assignment to EMACS_INT stops GCC whining about limited range
of data type. */
- EMACS_INT pid = p->pid;;
+ EMACS_INT pid = p->pid;
/* No problem storing the pid here, as it is still in Vprocess_alist. */
deleted_pid_list = Fcons (make_fixnum_or_float (pid),
@@ -830,7 +830,8 @@ nil, indicating the current buffer's process. */)
if (CONSP (p->status))
symbol = XCAR (p->status);
if (EQ (symbol, Qsignal) || EQ (symbol, Qexit))
- Fdelete (make_fixnum_or_float (pid), deleted_pid_list);
+ deleted_pid_list
+ = Fdelete (make_fixnum_or_float (pid), deleted_pid_list);
else
#endif
{
@@ -1818,7 +1819,8 @@ create_process (process, new_argv, current_dir)
char **new_argv;
Lisp_Object current_dir;
{
- int pid, inchannel, outchannel;
+ int inchannel, outchannel;
+ pid_t pid;
int sv[2];
#ifdef POSIX_SIGNALS
sigset_t procmask;
@@ -3339,13 +3341,17 @@ usage: (make-network-process &rest ARGS) */)
#endif
}
+ immediate_quit = 0;
+
#ifdef HAVE_GETADDRINFO
if (res != &ai)
- freeaddrinfo (res);
+ {
+ BLOCK_INPUT;
+ freeaddrinfo (res);
+ UNBLOCK_INPUT;
+ }
#endif
- immediate_quit = 0;
-
/* Discard the unwind protect for closing S, if any. */
specpdl_ptr = specpdl + count1;
@@ -6491,7 +6497,7 @@ sigchld_handler (signo)
while (1)
{
- register EMACS_INT pid;
+ pid_t pid;
WAITTYPE w;
Lisp_Object tail;
@@ -6500,12 +6506,17 @@ sigchld_handler (signo)
#define WUNTRACED 0
#endif /* no WUNTRACED */
/* Keep trying to get a status until we get a definitive result. */
- do
+ while (1)
{
errno = 0;
pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
+ if (! (pid < 0 && errno == EINTR))
+ break;
+ /* Avoid a busyloop: wait3 is a system call, so we do not want
+ to prevent the kernel from actually sending SIGCHLD to emacs
+ by asking for it all the time. */
+ sleep (1);
}
- while (pid < 0 && errno == EINTR);
if (pid <= 0)
{
@@ -6531,11 +6542,15 @@ sigchld_handler (signo)
/* Find the process that signaled us, and record its status. */
/* The process can have been deleted by Fdelete_process. */
- tail = Fmember (make_fixnum_or_float (pid), deleted_pid_list);
- if (!NILP (tail))
+ for (tail = deleted_pid_list; GC_CONSP (tail); tail = XCDR (tail))
{
- Fsetcar (tail, Qnil);
- goto sigchld_end_of_loop;
+ Lisp_Object xpid = XCAR (tail);
+ if ((GC_INTEGERP (xpid) && pid == (pid_t) XINT (xpid))
+ || (GC_FLOATP (xpid) && pid == (pid_t) XFLOAT_DATA (xpid)))
+ {
+ XSETCAR (tail, Qnil);
+ goto sigchld_end_of_loop;
+ }
}
/* Otherwise, if it is asynchronous, it is in Vprocess_alist. */