From 1999e3fc21a63f5c4306da486a3d9d69359c50eb Mon Sep 17 00:00:00 2001 From: wangyikai Date: Thu, 17 Apr 2025 15:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90hdf=5Fcore=E3=80=91smq=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=BB=B4=E6=B5=8B=E6=97=A5=E5=BF=97=EF=BC=8C=E8=BE=85?= =?UTF-8?q?=E5=8A=A9=E4=B8=8A=E5=B1=82=E5=AE=9A=E4=BD=8Dsmq=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyikai --- interfaces/inner_api/hdi/base/hdi_smq.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/interfaces/inner_api/hdi/base/hdi_smq.h b/interfaces/inner_api/hdi/base/hdi_smq.h index f710eeb2d..887897694 100644 --- a/interfaces/inner_api/hdi/base/hdi_smq.h +++ b/interfaces/inner_api/hdi/base/hdi_smq.h @@ -539,6 +539,8 @@ int SharedMemQueue::WriteNonBlocking(const T *data, size_t count) auto avalidWrite = GetAvalidWriteSize(); if (count > avalidWrite && meta_->GetType() == SmqType::SYNCED_SMQ) { // synced smq can not overflow write + HDF_LOGE("No sufficient space to write, try to write %{public}zu data, but currently " + "maximum writen space is %{public}zu.", count, avalidWrite); return -E2BIG; } @@ -576,10 +578,13 @@ template int SharedMemQueue::ReadNonBlocking(T *data, size_t count) { if (count == 0) { + HDF_LOGE("Try to read zero data from smq!"); return -EINVAL; } - - if (count > GetAvalidReadSize()) { + size_t availableRdsize = GetAvalidReadSize(); + if (count > availableRdsize) { + HDF_LOGE("No sufficient data to read, try to read %{public}zu data, " + "but available rd size is %{public}zu.", count, availableRdsize); return -ENODATA; } -- Gitee