* wait.cc (wait4): Initialize pointer on entry. Avoid calling
call_signal_handler twice since that guarantees exiting with errno set to EINTR.
This commit is contained in:
parent
07411d4c2e
commit
183f4d8086
|
@ -1,3 +1,9 @@
|
||||||
|
2004-03-12 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* wait.cc (wait4): Initialize pointer on entry. Avoid calling
|
||||||
|
call_signal_handler twice since that guarantees exiting with errno set
|
||||||
|
to EINTR.
|
||||||
|
|
||||||
2004-03-12 Corinna Vinschen <corinna@vinschen.de>
|
2004-03-12 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* exceptions.cc (sigpacket::process): Simplify code slightly.
|
* exceptions.cc (sigpacket::process): Simplify code slightly.
|
||||||
|
|
|
@ -48,25 +48,23 @@ wait4 (int intpid, int *status, int options, struct rusage *r)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
HANDLE waitfor;
|
HANDLE waitfor;
|
||||||
waitq *w;
|
waitq *w = &_my_tls.wq;
|
||||||
|
|
||||||
pthread_testcancel ();
|
pthread_testcancel ();
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
sig_dispatch_pending ();
|
sig_dispatch_pending ();
|
||||||
bool sawsig = false;
|
|
||||||
if (options & ~(WNOHANG | WUNTRACED))
|
if (options & ~(WNOHANG | WUNTRACED))
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return -1;
|
res = -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r)
|
if (r)
|
||||||
memset (r, 0, sizeof (*r));
|
memset (r, 0, sizeof (*r));
|
||||||
|
|
||||||
w = &_my_tls.wq;
|
|
||||||
|
|
||||||
w->pid = intpid;
|
w->pid = intpid;
|
||||||
w->options = options;
|
w->options = options;
|
||||||
w->rusage = r;
|
w->rusage = r;
|
||||||
|
@ -77,7 +75,7 @@ wait4 (int intpid, int *status, int options, struct rusage *r)
|
||||||
set_errno (ENOSYS);
|
set_errno (ENOSYS);
|
||||||
paranoid_printf ("proc_subproc returned 0");
|
paranoid_printf ("proc_subproc returned 0");
|
||||||
res = -1;
|
res = -1;
|
||||||
goto done;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((waitfor = w->ev) == NULL)
|
if ((waitfor = w->ev) == NULL)
|
||||||
|
@ -93,14 +91,14 @@ wait4 (int intpid, int *status, int options, struct rusage *r)
|
||||||
/* found no children */
|
/* found no children */
|
||||||
set_errno (ECHILD);
|
set_errno (ECHILD);
|
||||||
res = -1;
|
res = -1;
|
||||||
goto done;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w->status == -1)
|
if (w->status == -1)
|
||||||
{
|
{
|
||||||
|
if (_my_tls.call_signal_handler ())
|
||||||
|
continue;
|
||||||
set_sig_errno (EINTR);
|
set_sig_errno (EINTR);
|
||||||
_my_tls.call_signal_handler ();
|
|
||||||
sawsig = true;
|
|
||||||
res = -1;
|
res = -1;
|
||||||
}
|
}
|
||||||
else if (res != WAIT_OBJECT_0)
|
else if (res != WAIT_OBJECT_0)
|
||||||
|
@ -112,10 +110,7 @@ wait4 (int intpid, int *status, int options, struct rusage *r)
|
||||||
}
|
}
|
||||||
else if ((res = w->pid) != 0 && status)
|
else if ((res = w->pid) != 0 && status)
|
||||||
*status = w->status;
|
*status = w->status;
|
||||||
|
break;
|
||||||
done:
|
|
||||||
if (!sawsig || !_my_tls.call_signal_handler ())
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sigproc_printf ("intpid %d, status %p, w->status %d, options %d, res %d",
|
sigproc_printf ("intpid %d, status %p, w->status %d, options %d, res %d",
|
||||||
|
|
Loading…
Reference in New Issue