Bug 718629 - intermittent waitpid failure causes OpenGL features to be blacklisted on X11 - r=karlt

This commit is contained in:
Benoit Jacob 2012-01-31 15:32:05 -05:00
Родитель b9aef8fe2e
Коммит 444c5c0219
2 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -231,15 +231,6 @@ static void glxtest()
if (length >= bufsize)
fatal_error("GL strings length too large for buffer size");
///// Check that no X error happened /////
// In case of X errors, our X error handler will exit() now.
// We really want to make sure that the system is able to create a GL context without generating X errors,
// as these would crash the application.
XSync(dpy, False);
///// Finally write data to the pipe /////
write(write_end_of_the_pipe, buf, length);
///// Clean up. Indeed, the parent process might fail to kill us (e.g. if it doesn't need to check GL info)
///// so we might be staying alive for longer than expected, so it's important to consume as little memory as
///// possible. Also we want to check that we're able to do that too without generating X errors.
@ -249,6 +240,9 @@ static void glxtest()
XFreePixmap(dpy, pixmap);
XCloseDisplay(dpy);
dlclose(libgl);
///// Finally write data to the pipe
write(write_end_of_the_pipe, buf, length);
}
/** \returns true in the child glxtest process, false in the parent process */

Просмотреть файл

@ -93,7 +93,8 @@ GfxInfo::GetData()
close(glxtest_pipe);
glxtest_pipe = 0;
// bytesread < 0 would mean that the above read() call failed. This should never happen.
// bytesread < 0 would mean that the above read() call failed.
// This should never happen. If it did, the outcome would be to blacklist anyway.
if (bytesread < 0)
bytesread = 0;
@ -111,10 +112,15 @@ GfxInfo::GetData()
wait_for_glxtest_process = false;
if (waitpid(glxtest_pid, &glxtest_status, 0) == -1) {
waitpid_errno = errno;
if (waitpid_errno == EINTR)
if (waitpid_errno == EINTR) {
wait_for_glxtest_process = true;
else
waiting_for_glxtest_process_failed = true;
} else {
// Bug 718629
// ECHILD happens when the glxtest process got reaped got reaped after a PR_CreateProcess
// as per bug 227246. This shouldn't matter, as we still seem to get the data
// from the pipe, and if we didn't, the outcome would be to blacklist anyway.
waiting_for_glxtest_process_failed = (waitpid_errno != ECHILD);
}
}
}