+ /*
+ * check if someone quit or got killed in an unusual way
+ */
+ ret = waitpid(td->pid, &status, flags);
+ if (ret < 0) {
+ if (errno == ECHILD) {
+ log_err("fio: pid=%d disappeared %d\n", td->pid, td->runstate);
+ td_set_runstate(td, TD_REAPED);
+ goto reaped;
+ }
+ perror("waitpid");
+ } else if (ret == td->pid) {
+ if (WIFSIGNALED(status)) {
+ int sig = WTERMSIG(status);
+
+ log_err("fio: pid=%d, got signal=%d\n", td->pid, sig);
+ td_set_runstate(td, TD_REAPED);
+ goto reaped;
+ }
+ if (WIFEXITED(status)) {
+ if (WEXITSTATUS(status) && !td->error)
+ td->error = WEXITSTATUS(status);
+
+ td_set_runstate(td, TD_REAPED);
+ goto reaped;
+ }
+ }
+
+ /*
+ * thread is not dead, continue
+ */
+ continue;
+reaped: