mirror of
https://github.com/mirror/make.git
synced 2025-01-30 22:30:23 +08:00
Formerly job.c.~105~
This commit is contained in:
parent
0bab40c121
commit
5fc2539281
51
job.c
51
job.c
@ -204,6 +204,7 @@ reap_children (block, err)
|
|||||||
int exit_code, exit_sig, coredump;
|
int exit_code, exit_sig, coredump;
|
||||||
register struct child *lastc, *c;
|
register struct child *lastc, *c;
|
||||||
int child_failed;
|
int child_failed;
|
||||||
|
int any_remote;
|
||||||
|
|
||||||
if (err && dead_children == 0)
|
if (err && dead_children == 0)
|
||||||
{
|
{
|
||||||
@ -227,15 +228,31 @@ reap_children (block, err)
|
|||||||
if (dead_children != 0)
|
if (dead_children != 0)
|
||||||
--dead_children;
|
--dead_children;
|
||||||
|
|
||||||
if (debug_flag)
|
any_remote = 0;
|
||||||
for (c = children; c != 0; c = c->next)
|
for (c = children; c != 0; c = c->next)
|
||||||
printf ("Live child 0x%08lx PID %d%s\n",
|
{
|
||||||
(unsigned long int) c,
|
any_remote |= c->remote;
|
||||||
c->pid, c->remote ? " (remote)" : "");
|
if (debug_flag)
|
||||||
|
printf ("Live child 0x%08lx PID %d%s\n",
|
||||||
|
(unsigned long int) c,
|
||||||
|
c->pid, c->remote ? " (remote)" : "");
|
||||||
|
}
|
||||||
|
|
||||||
/* First, check for remote children. */
|
/* First, check for remote children. */
|
||||||
pid = remote_status (&exit_code, &exit_sig, &coredump, 0);
|
if (any_remote)
|
||||||
if (pid <= 0)
|
pid = remote_status (&exit_code, &exit_sig, &coredump, 0);
|
||||||
|
else
|
||||||
|
pid = 0;
|
||||||
|
if (pid < 0)
|
||||||
|
{
|
||||||
|
remote_status_lose:
|
||||||
|
#ifdef EINTR
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
pfatal_with_name ("remote_status");
|
||||||
|
}
|
||||||
|
else if (pid == 0)
|
||||||
{
|
{
|
||||||
/* No remote children. Check for local children. */
|
/* No remote children. Check for local children. */
|
||||||
|
|
||||||
@ -255,8 +272,24 @@ reap_children (block, err)
|
|||||||
pfatal_with_name ("wait");
|
pfatal_with_name ("wait");
|
||||||
}
|
}
|
||||||
else if (pid == 0)
|
else if (pid == 0)
|
||||||
/* No local children. */
|
{
|
||||||
break;
|
/* No local children. */
|
||||||
|
if (block && any_remote)
|
||||||
|
{
|
||||||
|
/* Now try a blocking wait for a remote child. */
|
||||||
|
pid = remote_status (&exit_code, &exit_sig, &coredump, 1);
|
||||||
|
if (pid < 0)
|
||||||
|
goto remote_status_lose;
|
||||||
|
else if (pid == 0)
|
||||||
|
/* No remote children either. Finally give up. */
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
/* We got a remote child. */
|
||||||
|
remote = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Chop the status word up. */
|
/* Chop the status word up. */
|
||||||
|
Loading…
Reference in New Issue
Block a user