Allow to block client on full buffer.
Bug: 130665360
Change-Id: I2f52dbb1a86664c81c8d21c68db79eed36a637fb
diff --git a/src/profiling/memory/wire_protocol.cc b/src/profiling/memory/wire_protocol.cc
index 76b72d9..67b0f38 100644
--- a/src/profiling/memory/wire_protocol.cc
+++ b/src/profiling/memory/wire_protocol.cc
@@ -61,6 +61,7 @@
iovecs[1].iov_len = sizeof(*msg.free_header);
} else {
PERFETTO_DFATAL("Neither alloc_header nor free_header set.");
+ errno = EINVAL;
return false;
}
@@ -83,6 +84,7 @@
ScopedSpinlock lock = shmem->AcquireLock(ScopedSpinlock::Mode::Try);
if (!lock.locked()) {
PERFETTO_DLOG("Failed to acquire spinlock.");
+ errno = EAGAIN;
return false;
}
buf = shmem->BeginWrite(lock, total_size);
@@ -90,6 +92,7 @@
if (!buf) {
PERFETTO_DFATAL("Buffer overflow.");
shmem->EndWrite(std::move(buf));
+ errno = EAGAIN;
return false;
}