From a85316dd1f5de6d952f7335666b55ff5c7fc84a5 Mon Sep 17 00:00:00 2001 From: wangyikai Date: Tue, 24 Jun 2025 21:09:54 +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?= 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interfaces/inner_api/hdi/base/hdi_smq.h b/interfaces/inner_api/hdi/base/hdi_smq.h index b0207428e..59c7b480f 100644 --- a/interfaces/inner_api/hdi/base/hdi_smq.h +++ b/interfaces/inner_api/hdi/base/hdi_smq.h @@ -464,11 +464,13 @@ int SharedMemQueue::Write(const T *data, size_t count, int64_t waitTimeNanoSe startTime = currentTime; if (waitTimeNanoSec <= 0) { ret = WriteNonBlocking(data, count); + HDF_LOGE("Non-positive waitTimeNanoSec, WriteNonBlocking ret: %{public}d.", ret); break; } } ret = syncer_->Wait(SharedMemQueueSyncer::SYNC_WORD_WRITE, waitTimeNanoSec); if (ret != 0 && ret != -ETIMEDOUT) { + HDF_LOGE("Write syncer wait failed, ret: %{public}d.", ret); break; } @@ -532,11 +534,13 @@ int SharedMemQueue::Read(T *data, size_t count, int64_t waitTimeNanoSec) startTime = currentTime; if (waitTimeNanoSec <= 0) { ret = ReadNonBlocking(data, count); + HDF_LOGE("Non-positive waitTimeNanoSec, ReadNonBlocking ret: %{public}d.", ret); break; } } ret = syncer_->Wait(SharedMemQueueSyncer::SYNC_WORD_READ, waitTimeNanoSec); if (ret != 0 && ret != -ETIMEDOUT) { + HDF_LOGE("Read syncer wait failed, ret: %{public}d.", ret); break; } @@ -584,6 +588,7 @@ int SharedMemQueue::WriteNonBlocking(const T *data, size_t count) if (wOffset + count <= (qCount + 1)) { if (memcpy_s(queueBuffer_ + (wOffset * sizeof(T)), (qCount + 1 - wOffset) * sizeof(T), data, count * sizeof(T)) != EOK) { + HDF_LOGE("whole memcpy_s failed."); return HDF_FAILURE; }; newWriteOffset = (wOffset + count) % (qCount + 1); @@ -592,9 +597,11 @@ int SharedMemQueue::WriteNonBlocking(const T *data, size_t count) size_t secPartSize = count - firstPartSize; if (memcpy_s(queueBuffer_ + (wOffset * sizeof(T)), (qCount + 1 - wOffset) * sizeof(T), data, firstPartSize * sizeof(T)) != EOK) { + HDF_LOGE("Twofold, first part memcpy_s failed."); return HDF_FAILURE; } if (memcpy_s(queueBuffer_, qCount * sizeof(T), data + firstPartSize, secPartSize * sizeof(T)) != EOK) { + HDF_LOGE("Twofold, second part memcpy_s failed."); return HDF_FAILURE; } newWriteOffset = secPartSize; -- Gitee