Merge changes If286ae5d,I0c89907e into main
* changes:
libhealthloop: Reduce the size of the uevent receive buffer
libhealthloop: Modify receive buffer overflow handling
diff --git a/health/utils/libhealthloop/HealthLoop.cpp b/health/utils/libhealthloop/HealthLoop.cpp
index 691d896..c5ad5a8 100644
--- a/health/utils/libhealthloop/HealthLoop.cpp
+++ b/health/utils/libhealthloop/HealthLoop.cpp
@@ -64,7 +64,7 @@
.get();
struct epoll_event ev = {
- .events = EPOLLIN,
+ .events = EPOLLIN | EPOLLERR,
.data.ptr = reinterpret_cast<void*>(event_handler),
};
@@ -128,6 +128,9 @@
for (;;) {
char msg[kUeventMsgLen + 2];
int n = uevent_kernel_multicast_recv(uevent_fd_, msg, kUeventMsgLen);
+ if (n < 0 && errno == ENOBUFS) {
+ update_stats = true;
+ }
if (n <= 0) return update_stats;
if (n >= kUeventMsgLen) {
// too long -- discard
@@ -177,7 +180,7 @@
}
void HealthLoop::UeventInit(void) {
- uevent_fd_.reset(uevent_create_socket(64 * 1024, true));
+ uevent_fd_.reset(uevent_create_socket(kUeventMsgLen, true));
if (uevent_fd_ < 0) {
KLOG_ERROR(LOG_TAG, "uevent_init: uevent_open_socket failed\n");