[llvm-exegesis] Print errno on failures in subprocess

Some error logging in llvm-exegesis under the subprocess executor just
prints a generic failure information rather than any details about the
error as we omit printing the string version of errno. This patch adds
in printing errno at all relevant points in the subprocess executor that
were previously missed.

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D157682
This commit is contained in:
Aiden Grossman 2023-08-11 00:59:25 -07:00
parent ca8dbdc12a
commit c4a769ba03

View File

@ -209,7 +209,8 @@ private:
ssize_t BytesWritten = sendmsg(SocketFD, &Message, 0);
if (BytesWritten < 0)
return make_error<Failure>("Failed to write FD to socket");
return make_error<Failure>("Failed to write FD to socket: " +
Twine(strerror(errno)));
return Error::success();
}
@ -224,7 +225,8 @@ private:
ssize_t BytesRead = recvmsg(SocketFD, &Message, 0);
if (BytesRead < 0)
return make_error<Failure>("Failed to read FD from socket");
return make_error<Failure>("Failed to read FD from socket: " +
Twine(strerror(errno)));
struct cmsghdr *ControlMessage = CMSG_FIRSTHDR(&Message);
@ -246,7 +248,8 @@ private:
if (PipeSuccessOrErr != 0) {
return make_error<Failure>(
"Failed to create a pipe for interprocess communication between "
"llvm-exegesis and the benchmarking subprocess");
"llvm-exegesis and the benchmarking subprocess: " +
Twine(strerror(errno)));
}
SubprocessMemory SPMemory;