!670 当hilog/hievent驱动缓存出问题时,进行恢复处理

Merge pull request !670 from shenchenkai/master
This commit is contained in:
openharmony_ci 2021-10-28 02:03:03 +00:00 committed by Gitee
commit 91c1737d1b
1 changed files with 7 additions and 0 deletions

View File

@ -201,6 +201,13 @@ static ssize_t HiLogRead(struct file *filep, char *buffer, size_t bufLen)
HiLogBufferDec(header.len); HiLogBufferDec(header.len);
retval = header.len + sizeof(header); retval = header.len + sizeof(header);
out: out:
if (retval == -ENOMEM) {
// clean ring buffer
g_hiLogDev.writeOffset = 0;
g_hiLogDev.headOffset = 0;
g_hiLogDev.size = 0;
g_hiLogDev.count = 0;
}
(VOID)LOS_MuxRelease(&g_hiLogDev.mtx); (VOID)LOS_MuxRelease(&g_hiLogDev.mtx);
return retval; return retval;
} }