mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:43:57 +00:00
[vm/bin] Improve error message in WakeupHandler
Instead of writing errno into stderr via perror include it into FATAL message. This will help us to dignoze the problem in environments where FATAL messages are preserved as part of the crash report. TEST=tested manually by changing write() parameters to be invalid Bug: b/279184589 Change-Id: I45424af6064f9eec258a3bff1f96488b8a60f095 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298862 Commit-Queue: Slava Egorov <vegorov@google.com> Reviewed-by: Brian Quinlan <bquinlan@google.com>
This commit is contained in:
parent
50f65c4f39
commit
2b9140a8f7
|
@ -104,10 +104,10 @@ class InterruptMessage {
|
|||
int64_t data;
|
||||
};
|
||||
|
||||
static constexpr int kInterruptMessageSize = sizeof(InterruptMessage);
|
||||
static constexpr int kInfinityTimeout = -1;
|
||||
static constexpr int kTimerId = -1;
|
||||
static constexpr int kShutdownId = -2;
|
||||
static constexpr intptr_t kInterruptMessageSize = sizeof(InterruptMessage);
|
||||
static constexpr intptr_t kInfinityTimeout = -1;
|
||||
static constexpr intptr_t kTimerId = -1;
|
||||
static constexpr intptr_t kShutdownId = -2;
|
||||
|
||||
template <typename T>
|
||||
class CircularLinkedList {
|
||||
|
|
|
@ -178,9 +178,12 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
|||
FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize);
|
||||
if (result != kInterruptMessageSize) {
|
||||
if (result == -1) {
|
||||
perror("Interrupt message failure:");
|
||||
FATAL("Interrupt message failure: %s", strerror(errno));
|
||||
} else {
|
||||
FATAL("Interrupt message failure: expected to write %" Pd
|
||||
" bytes, but wrote %" Pd ".",
|
||||
kInterruptMessageSize, result);
|
||||
}
|
||||
FATAL("Interrupt message failure. Wrote %" Pd " bytes.", result);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,9 +186,12 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
|||
FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize);
|
||||
if (result != kInterruptMessageSize) {
|
||||
if (result == -1) {
|
||||
perror("Interrupt message failure:");
|
||||
FATAL("Interrupt message failure: %s", strerror(errno));
|
||||
} else {
|
||||
FATAL("Interrupt message failure: expected to write %" Pd
|
||||
" bytes, but wrote %" Pd ".",
|
||||
kInterruptMessageSize, result);
|
||||
}
|
||||
FATAL("Interrupt message failure. Wrote %" Pd " bytes.", result);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -194,9 +194,12 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
|||
FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize);
|
||||
if (result != kInterruptMessageSize) {
|
||||
if (result == -1) {
|
||||
perror("Interrupt message failure:");
|
||||
FATAL("Interrupt message failure: %s", strerror(errno));
|
||||
} else {
|
||||
FATAL("Interrupt message failure: expected to write %" Pd
|
||||
" bytes, but wrote %" Pd ".",
|
||||
kInterruptMessageSize, result);
|
||||
}
|
||||
FATAL("Interrupt message failure. Wrote %" Pd " bytes.", result);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue