--- a/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc
+++ b/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc
@@ -76,32 +76,16 @@ bool
IsProcessDead(pid_t process)
{
bool exited = false;
// don't care if the process crashed, just if it exited
base::DidProcessCrash(&exited, process);
return exited;
}
-bool
-WaitForProcessExitMaxSecs(pid_t process, int maxSecs)
-{
- bool infiniteWait = (maxSecs < 0);
- int status;
- int nWaits = 0;
-
- do {
- HANDLE_EINTR(waitpid(process, &status, WNOHANG));
- } while (!WIFEXITED(status) &&
- (infiniteWait || nWaits++ < maxSecs) &&
- 0 == HANDLE_EINTR(sleep(1)));
-
- return WIFEXITED(status);
-}
-
class ChildReaper : public base::MessagePumpLibevent::SignalEvent,
public base::MessagePumpLibevent::SignalWatcher
{
public:
explicit ChildReaper(pid_t process) : process_(process)
{
}
@@ -137,26 +121,30 @@ protected:
printf("TEST-UNEXPECTED-FAIL | process %d busy-waiting on | child process %d\n", getpid(), process_);
#if 0
HANDLE_EINTR(waitpid(process_, NULL, 0));
#else
- if (WaitForProcessExitMaxSecs(process_, 30)) {
- printf("TEST-UNEXPECTED-FAIL | process %d done busy-waiting on | child process %d exited normally\n", getpid(), process_);
- return;
- }
+ const int maxWaits = 30;
+ int waits = 0;
+ while (!IsProcessDead(process_) && ++waits < maxWaits)
+ sleep(1);
- printf("TEST-UNEXPECTED-FAIL | process %d wait on | child process %d timed out!\n", getpid(), process_);
- // kill the child in such a way that breakpad is triggered
- kill(process_, SIGSEGV);
-
- WaitForProcessExitMaxSecs(process_, -1); // wait "forever"
+ if (waits < maxWaits) {
+ printf("TEST-UNEXPECTED-FAIL | process %d done busy-waiting on | child process %d\n", getpid(), process_);
+ }
+ else {
+ printf("TEST-UNEXPECTED-FAIL | process %d wait on | child process %d timed out!\n", getpid(), process_);
+ // kill the child in such a way that breakpad is triggered
+ kill(process_, SIGSEGV);
+ HANDLE_EINTR(waitpid(process_, NULL, 0));
+ }
#endif
}
pid_t process_;
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1043,25 +1043,16 @@ OnChildProcessDumpRequested(void* aConte
getter_AddRefs(lf));
pid = aClientInfo->pid();
#else
NS_NewNativeLocalFile(nsDependentCString(aFilePath->c_str()), PR_FALSE,
getter_AddRefs(lf));
pid = aClientInfo->pid_;
#endif
-
-
-#ifdef XP_LINUX
- printf("TEST-UNEXPECTED-FAIL | got minidump at | %s\n", aFilePath->c_str());
-#endif
-
-
-
-
// Get an .extra file with the same base name as the .dmp file
nsCOMPtr<nsIFile> extraFile;
nsresult rv = lf->Clone(getter_AddRefs(extraFile));
if (NS_FAILED(rv))
return;
nsAutoString leafName;
rv = extraFile->GetLeafName(leafName);
@@ -1072,24 +1063,16 @@ OnChildProcessDumpRequested(void* aConte
NS_LITERAL_STRING("extra"));
rv = extraFile->SetLeafName(leafName);
if (NS_FAILED(rv))
return;
// Now write out the annotations to it
nsCOMPtr<nsIFileOutputStream> stream =
do_CreateInstance("@mozilla.org/network/file-output-stream;1");
-
-
-
- if (!stream)
- return;
-
-
-
rv = stream->Init(extraFile, -1, 0600, 0);
if (NS_FAILED(rv))
return;
crashReporterAPIData_Hash->EnumerateRead(EnumerateChildAnnotations,
stream.get());
// Add CrashTime to extra data
time_t crashTime = time(NULL);
char crashTimeString[32];