Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
a04ab13c
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
460
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看板
未验证
提交
a04ab13c
编写于
4月 21, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 21, 2023
浏览文件
操作
浏览文件
下载
差异文件
!1152 修复获取容器信息失败
Merge pull request !1152 from zhushengle/container_bug
上级
5fb9165c
338f5d7e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
17 deletion
+37
-17
fs/proc/os_adapt/process_proc.c
fs/proc/os_adapt/process_proc.c
+30
-4
fs/vfs/vnode.c
fs/vfs/vnode.c
+1
-1
syscall/fs_syscall.c
syscall/fs_syscall.c
+1
-1
testsuites/unittest/process/fs/smoke/It_process_fs_013.cpp
testsuites/unittest/process/fs/smoke/It_process_fs_013.cpp
+5
-11
未找到文件。
fs/proc/os_adapt/process_proc.c
浏览文件 @
a04ab13c
...
...
@@ -103,6 +103,8 @@ static ssize_t ProcessContainerLink(unsigned int containerID, ContainerType type
static
ssize_t
ProcessContainerReadLink
(
struct
ProcDirEntry
*
entry
,
char
*
buffer
,
size_t
bufLen
)
{
char
*
freeBuf
=
NULL
;
char
*
buf
=
buffer
;
ssize_t
count
;
unsigned
int
intSave
;
if
(
entry
==
NULL
)
{
...
...
@@ -112,17 +114,41 @@ static ssize_t ProcessContainerReadLink(struct ProcDirEntry *entry, char *buffer
if
(
data
==
NULL
)
{
return
-
EINVAL
;
}
if
(
LOS_IsUserAddressRange
((
VADDR_T
)(
UINTPTR
)
buffer
,
bufLen
))
{
buf
=
LOS_MemAlloc
(
m_aucSysMem1
,
bufLen
);
if
(
buf
==
NULL
)
{
return
-
ENOMEM
;
}
(
void
)
memset_s
(
buf
,
bufLen
,
0
,
bufLen
);
freeBuf
=
buf
;
}
LosProcessCB
*
processCB
=
ProcGetProcessCB
(
data
);
SCHEDULER_LOCK
(
intSave
);
UINT32
containerID
=
OsGetContainerID
(
processCB
,
(
ContainerType
)
data
->
type
);
SCHEDULER_UNLOCK
(
intSave
);
if
(
containerID
!=
OS_INVALID_VALUE
)
{
return
ProcessContainerLink
(
containerID
,
(
ContainerType
)
data
->
type
,
buffer
,
bufLen
);
count
=
ProcessContainerLink
(
containerID
,
(
ContainerType
)
data
->
type
,
buf
,
bufLen
);
}
else
{
count
=
strlen
(
"(unknown)"
);
if
(
memcpy_s
(
buf
,
bufLen
,
"(unknown)"
,
count
+
1
)
!=
EOK
)
{
(
void
)
LOS_MemFree
(
m_aucSysMem1
,
freeBuf
);
return
-
EBADF
;
}
}
count
=
strlen
(
"(unknown)"
);
if
(
memcpy_s
(
buffer
,
bufLen
,
"(unknown)"
,
count
+
1
)
!=
EOK
)
{
return
-
EBADF
;
if
(
count
<
0
)
{
(
void
)
LOS_MemFree
(
m_aucSysMem1
,
freeBuf
);
return
count
;
}
if
(
LOS_IsUserAddressRange
((
VADDR_T
)(
UINTPTR
)
buffer
,
bufLen
))
{
if
(
LOS_ArchCopyToUser
(
buffer
,
buf
,
bufLen
)
!=
0
)
{
(
void
)
LOS_MemFree
(
m_aucSysMem1
,
freeBuf
);
return
-
EFAULT
;
}
}
(
void
)
LOS_MemFree
(
m_aucSysMem1
,
freeBuf
);
return
count
;
}
...
...
fs/vfs/vnode.c
浏览文件 @
a04ab13c
...
...
@@ -138,7 +138,7 @@ int VnodeAlloc(struct VnodeOps *vop, struct Vnode **newVnode)
VnodeHold
();
vnode
=
GetFromFreeList
();
if
((
vnode
==
NULL
)
&&
g_totalVnodeSize
<
LOSCFG_MAX_VNODE_SIZE
)
{
vnode
=
(
struct
Vnode
*
)
zalloc
(
sizeof
(
struct
Vnode
));
vnode
=
(
struct
Vnode
*
)
zalloc
(
sizeof
(
struct
Vnode
));
g_totalVnodeSize
++
;
}
...
...
syscall/fs_syscall.c
浏览文件 @
a04ab13c
...
...
@@ -321,7 +321,7 @@ static unsigned int ProcRealProcessIDGet(unsigned int pid)
SCHEDULER_LOCK
(
intSave
);
LosProcessCB
*
pcb
=
OsGetPCBFromVpid
(
pid
);
if
(
pcb
==
NULL
)
{
if
(
OsProcessIsInactive
(
pcb
)
)
{
SCHEDULER_UNLOCK
(
intSave
);
return
0
;
}
...
...
testsuites/unittest/process/fs/smoke/It_process_fs_013.cpp
浏览文件 @
a04ab13c
...
...
@@ -30,19 +30,13 @@
#include <gtest/gtest.h>
#include "It_process_fs_test.h"
static
const
int
ini_process_max
=
3
;
void
ItProcessFs013
(
void
)
{
std
::
string
path
;
DIR
*
dirp
=
nullptr
;
for
(
int
i
=
1
;
i
<=
ini_process_max
;
i
++
)
{
if
(
i
!=
2
)
{
/* 2: skip kernel process */
path
=
GenProcPidPath
(
i
);
printf
(
"path: %s
\n
"
,
path
.
c_str
());
dirp
=
opendir
(
path
.
data
());
ASSERT_NE
(
dirp
,
nullptr
);
(
void
)
closedir
(
dirp
);
};
}
path
=
GenProcPidPath
(
1
);
printf
(
"path: %s
\n
"
,
path
.
c_str
());
dirp
=
opendir
(
path
.
data
());
ASSERT_NE
(
dirp
,
nullptr
);
(
void
)
closedir
(
dirp
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录