#include <sys/wait.h>
#include <unistd.h>
-#include <base/logging.h>
+#include <android-base/logging.h>
std::unique_ptr<Workload> Workload::CreateWorkload(const std::vector<std::string>& args) {
std::unique_ptr<Workload> workload(new Workload(args));
close(start_signal_pipe[1]);
close(exec_child_pipe[0]);
ChildProcessFn(args_, start_signal_pipe[0], exec_child_pipe[1]);
+ _exit(0);
}
// In parent process.
close(start_signal_pipe[0]);
TEMP_FAILURE_RETRY(write(exec_child_fd, &exec_child_failed, 1));
close(exec_child_fd);
errno = saved_errno;
- PLOG(ERROR) << "execvp(" << argv[0] << ") failed";
+ PLOG(ERROR) << "child process failed to execvp(" << argv[0] << ")";
} else {
- PLOG(DEBUG) << "child process failed to receive start_signal, nread = " << nread;
+ PLOG(ERROR) << "child process failed to receive start_signal, nread = " << nread;
}
- exit(1);
}
bool Workload::Start() {
char exec_child_failed;
ssize_t nread = TEMP_FAILURE_RETRY(read(exec_child_fd_, &exec_child_failed, 1));
if (nread != 0) {
- ((nread == -1) ? PLOG(ERROR) : LOG(ERROR)) << "exec child failed, nread = " << nread;
+ if (nread == -1) {
+ PLOG(ERROR) << "failed to receive error message from child process";
+ } else {
+ LOG(ERROR) << "received error message from child process";
+ }
return false;
}
work_state_ = Started;