Accepting request 385719 from home:michel_mno:branches:devel:gcc
- update gdb-orphanripper.c from last fedora changes of 2013 http://pkgs.fedoraproject.org/cgit/rpms/gdb.git/log/gdb-orphanripper.c may be solution to transient build hung on Rings:1 ppc64le tracked by bug boo#974419 OBS-URL: https://build.opensuse.org/request/show/385719 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=135
This commit is contained in:
parent
ed40f146bf
commit
c795ce3796
@ -47,13 +47,10 @@
|
||||
|
||||
static const char *progname;
|
||||
|
||||
static volatile int signal_chld_hit = 0;
|
||||
static volatile pid_t child;
|
||||
|
||||
static void signal_chld (int signo)
|
||||
{
|
||||
if (child && kill (child, 0) != 0)
|
||||
signal_chld_hit = 1;
|
||||
}
|
||||
|
||||
static volatile int signal_alrm_hit = 0;
|
||||
@ -104,6 +101,44 @@ static int read_out (int amaster)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* kill (child, 0) == 0 sometimes even when CHILD's state is already "Z". */
|
||||
|
||||
static int child_exited (void)
|
||||
{
|
||||
char buf[200];
|
||||
int fd, i, retval;
|
||||
ssize_t got;
|
||||
char state[3];
|
||||
|
||||
snprintf (buf, sizeof (buf), "/proc/%ld/stat", (long) child);
|
||||
fd = open (buf, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
perror ("open (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
got = read (fd, buf, sizeof(buf));
|
||||
if (got <= 0)
|
||||
{
|
||||
perror ("read (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (close (fd) != 0)
|
||||
{
|
||||
perror ("close (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
/* RHEL-5 does not support %ms. */
|
||||
i = sscanf (buf, "%*d%*s%2s", state);
|
||||
if (i != 1)
|
||||
{
|
||||
perror ("sscanf (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
retval = strcmp (state, "Z") == 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int spawn (char **argv, int timeout)
|
||||
{
|
||||
pid_t child_got;
|
||||
@ -157,6 +192,11 @@ static int spawn (char **argv, int timeout)
|
||||
assert (i == STDIN_FILENO);
|
||||
#endif
|
||||
|
||||
i = sigemptyset (&set);
|
||||
assert (i == 0);
|
||||
i = sigprocmask (SIG_SETMASK, &set, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
/* Do not setpgrp(2) in the parent process as the process-group
|
||||
is shared for the whole sh(1) pipeline we could be a part
|
||||
of. The process-group is set according to PID of the first
|
||||
@ -206,7 +246,7 @@ static int spawn (char **argv, int timeout)
|
||||
i = ppoll (&pollfd, 1, NULL, &set);
|
||||
if (i == -1 && errno == EINTR)
|
||||
{
|
||||
if (signal_chld_hit)
|
||||
if (child_exited ())
|
||||
break;
|
||||
/* Non-CHILD child may have exited. */
|
||||
continue;
|
||||
@ -230,7 +270,7 @@ static int spawn (char **argv, int timeout)
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
/* Child exited? */
|
||||
if (signal_chld_hit)
|
||||
if (child_exited ())
|
||||
break;
|
||||
}
|
||||
|
||||
@ -279,12 +319,10 @@ static int spawn (char **argv, int timeout)
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* In the POLLHUP case we may not have seen SIGCHLD so far. */
|
||||
/* Not used in fact. */
|
||||
i = sigprocmask (SIG_SETMASK, &set, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
assert (signal_chld_hit != 0);
|
||||
|
||||
/* Do not unset O_NONBLOCK as a stale child (the whole purpose of this
|
||||
program) having open its output pty would block us in read_out. */
|
||||
#if 0
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 7 09:56:22 UTC 2016 - normand@linux.vnet.ibm.com
|
||||
|
||||
- update gdb-orphanripper.c from last fedora changes of 2013
|
||||
http://pkgs.fedoraproject.org/cgit/rpms/gdb.git/log/gdb-orphanripper.c
|
||||
may be solution to transient build hung on Rings:1 ppc64le
|
||||
tracked by bug boo#974419
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 21 09:02:11 UTC 2016 - rguenther@suse.com
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user