Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
9bc3a1cf
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
大约 1 年 前同步成功
通知
456
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9bc3a1cf
编写于
12月 03, 2020
作者:
O
openharmony_ci
提交者:
Gitee
12月 03, 2020
浏览文件
操作
浏览文件
下载
差异文件
!37 修复SYSV shm有关函数
Merge pull request !37 from laokz/shm
上级
8271a069
bd9b180b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
11 deletion
+17
-11
kernel/base/vm/shm.c
kernel/base/vm/shm.c
+17
-11
未找到文件。
kernel/base/vm/shm.c
浏览文件 @
9bc3a1cf
...
@@ -337,10 +337,14 @@ VOID OsShmRegionFree(LosVmSpace *space, LosVmMapRegion *region)
...
@@ -337,10 +337,14 @@ VOID OsShmRegionFree(LosVmSpace *space, LosVmMapRegion *region)
return
;
return
;
}
}
LOS_ArchMmuUnmap
(
&
space
->
archMmu
,
region
->
range
.
base
,
region
->
range
.
size
>>
PAGE_SHIFT
);
ShmPagesRefDec
(
seg
);
ShmPagesRefDec
(
seg
);
seg
->
ds
.
shm_nattch
--
;
seg
->
ds
.
shm_nattch
--
;
if
(
seg
->
ds
.
shm_nattch
<=
0
)
{
if
(
seg
->
ds
.
shm_nattch
<=
0
&&
(
seg
->
status
&
SHM_SEG_REMOVE
)
)
{
ShmFreeSeg
(
seg
);
ShmFreeSeg
(
seg
);
}
else
{
seg
->
ds
.
shm_dtime
=
time
(
NULL
);
seg
->
ds
.
shm_lpid
=
LOS_GetCurrProcessID
();
/* may not be the space's PID. */
}
}
SYSV_SHM_UNLOCK
();
SYSV_SHM_UNLOCK
();
}
}
...
@@ -411,7 +415,7 @@ INT32 ShmGet(key_t key, size_t size, INT32 shmflg)
...
@@ -411,7 +415,7 @@ INT32 ShmGet(key_t key, size_t size, INT32 shmflg)
SYSV_SHM_LOCK
();
SYSV_SHM_LOCK
();
if
((((
UINT32
)
shmflg
&
IPC_CREAT
)
==
0
)
&&
if
((((
UINT32
)
shmflg
&
IPC_CREAT
)
==
0
)
&&
(((
UINT32
)
shmflg
&
IPC_EXCL
)
==
0
))
{
(((
UINT32
)
shmflg
&
IPC_EXCL
)
==
1
))
{
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
ERROR
;
goto
ERROR
;
}
}
...
@@ -487,13 +491,15 @@ LosVmMapRegion *ShmatVmmAlloc(struct shmIDSource *seg, const VOID *shmaddr,
...
@@ -487,13 +491,15 @@ LosVmMapRegion *ShmatVmmAlloc(struct shmIDSource *seg, const VOID *shmaddr,
}
else
{
}
else
{
vaddr
=
(
VADDR_T
)(
UINTPTR
)
shmaddr
;
vaddr
=
(
VADDR_T
)(
UINTPTR
)
shmaddr
;
}
}
if
((
shmflg
&
SHM_REMAP
))
{
if
(
!
(
shmflg
&
SHM_REMAP
)
&&
(
LOS_RegionFind
(
space
,
vaddr
)
||
LOS_RegionFind
(
space
,
vaddr
+
seg
->
ds
.
shm_segsz
-
1
)
||
LOS_RegionRangeFind
(
space
,
vaddr
,
seg
->
ds
.
shm_segsz
-
1
)))
{
ret
=
EINVAL
;
goto
ERROR
;
}
vaddr
=
(
VADDR_T
)
LOS_MMap
(
vaddr
,
seg
->
ds
.
shm_segsz
,
prot
,
vaddr
=
(
VADDR_T
)
LOS_MMap
(
vaddr
,
seg
->
ds
.
shm_segsz
,
prot
,
MAP_ANONYMOUS
|
MAP_SHARED
,
-
1
,
0
);
MAP_ANONYMOUS
|
MAP_SHARED
,
-
1
,
0
);
region
=
LOS_RegionFind
(
space
,
vaddr
);
region
=
LOS_RegionFind
(
space
,
vaddr
);
}
else
{
region
=
LOS_RegionAlloc
(
space
,
vaddr
,
seg
->
ds
.
shm_segsz
,
regionFlags
,
0
);
}
}
}
if
(
region
==
NULL
)
{
if
(
region
==
NULL
)
{
...
@@ -718,10 +724,10 @@ INT32 ShmDt(const VOID *shmaddr)
...
@@ -718,10 +724,10 @@ INT32 ShmDt(const VOID *shmaddr)
if
((
seg
->
ds
.
shm_nattch
<=
0
)
&&
if
((
seg
->
ds
.
shm_nattch
<=
0
)
&&
(
seg
->
status
&
SHM_SEG_REMOVE
))
{
(
seg
->
status
&
SHM_SEG_REMOVE
))
{
ShmFreeSeg
(
seg
);
ShmFreeSeg
(
seg
);
}
}
else
{
seg
->
ds
.
shm_dtime
=
time
(
NULL
);
seg
->
ds
.
shm_dtime
=
time
(
NULL
);
seg
->
ds
.
shm_lpid
=
LOS_GetCurrProcessID
();
seg
->
ds
.
shm_lpid
=
LOS_GetCurrProcessID
();
}
SYSV_SHM_UNLOCK
();
SYSV_SHM_UNLOCK
();
(
VOID
)
LOS_MuxRelease
(
&
space
->
regionMux
);
(
VOID
)
LOS_MuxRelease
(
&
space
->
regionMux
);
return
0
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录