提交 9fdb80f8 编写于 作者: H Haryslee

fix: 共享内存问题修复

Signed-off-by: NHaryslee <lihao189@huawei.com>
背景:父进程移除共享内存并标记SHM_SEG_REMOVE,当子进程资源回收时在
ShmFindSeg接口中判断该共享内存具有SHM_SEG_REMOVE时返回空,但是此时
seg->ds.shm_nattch不为0,不应返回空。
方案:ShmFindSeg接口中增加seg->ds.shm_nattch为0的判断。

close #I47X2Z

Change-Id: I8735cd11ac237b17fa745c50313da0fd0649bb9f
上级 93e74c5f
...@@ -304,7 +304,7 @@ STATIC struct shmIDSource *ShmFindSeg(int shmid) ...@@ -304,7 +304,7 @@ STATIC struct shmIDSource *ShmFindSeg(int shmid)
} }
seg = &g_shmSegs[shmid]; seg = &g_shmSegs[shmid];
if ((seg->status & SHM_SEG_FREE) || (seg->status & SHM_SEG_REMOVE)) { if ((seg->status & SHM_SEG_FREE) || ((seg->ds.shm_nattch == 0) && (seg->status & SHM_SEG_REMOVE))) {
set_errno(EIDRM); set_errno(EIDRM);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册