Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
93e74c5f
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看板
提交
93e74c5f
编写于
9月 23, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 23, 2021
浏览文件
操作
浏览文件
下载
差异文件
!520 修复sigwait等待到的信号值与获取的siginfo中的值不一致
Merge pull request !520 from lnlan/fixed_sigwait
上级
c0721f4f
c3facd1b
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
64 addition
and
2 deletion
+64
-2
kernel/base/core/los_task.c
kernel/base/core/los_task.c
+1
-0
kernel/base/include/los_signal.h
kernel/base/include/los_signal.h
+7
-0
kernel/base/ipc/los_signal.c
kernel/base/ipc/los_signal.c
+56
-2
未找到文件。
kernel/base/core/los_task.c
浏览文件 @
93e74c5f
...
...
@@ -498,6 +498,7 @@ LITE_OS_SEC_TEXT VOID OsTaskResourcesToFree(LosTaskCB *taskCB)
OsTaskKernelResourcesToFree
(
syncSignal
,
topOfStack
);
SCHEDULER_LOCK
(
intSave
);
OsClearSigInfoTmpList
(
&
(
taskCB
->
sig
));
OsInsertTCBToFreeList
(
taskCB
);
SCHEDULER_UNLOCK
(
intSave
);
}
...
...
kernel/base/include/los_signal.h
浏览文件 @
93e74c5f
...
...
@@ -132,6 +132,11 @@ struct sq_queue_s {
};
typedef
struct
sq_queue_s
sq_queue_t
;
typedef
struct
SigInfoListNode
{
struct
SigInfoListNode
*
next
;
siginfo_t
info
;
}
SigInfoListNode
;
typedef
struct
{
sigset_t
sigFlag
;
sigset_t
sigPendFlag
;
...
...
@@ -140,6 +145,7 @@ typedef struct {
LOS_DL_LIST
waitList
;
sigset_t
sigwaitmask
;
/* Waiting for pending signals */
siginfo_t
sigunbinfo
;
/* Signal info when task unblocked */
SigInfoListNode
*
tmpInfoListHead
;
/* Signal info List */
unsigned
int
sigIntLock
;
void
*
sigContext
;
unsigned
int
count
;
...
...
@@ -167,6 +173,7 @@ int OsSigSuspend(const sigset_t *set);
VOID
OsSigIntLock
(
VOID
);
VOID
OsSigIntUnlock
(
VOID
);
INT32
OsTaskKillUnsafe
(
UINT32
taskID
,
INT32
signo
);
VOID
OsClearSigInfoTmpList
(
sig_cb
*
sigcb
);
#ifdef __cplusplus
#if __cplusplus
...
...
kernel/base/ipc/los_signal.c
浏览文件 @
93e74c5f
...
...
@@ -67,11 +67,60 @@ int OsSigIsMember(const sigset_t *set, int signo)
return
ret
;
}
STATIC
VOID
OsMoveTmpInfoToUnbInfo
(
sig_cb
*
sigcb
,
INT32
signo
)
{
SigInfoListNode
*
tmpInfoNode
=
sigcb
->
tmpInfoListHead
;
SigInfoListNode
**
prevHook
=
&
sigcb
->
tmpInfoListHead
;
INT32
isFirstDel
=
1
;
while
(
tmpInfoNode
!=
NULL
)
{
if
(
tmpInfoNode
->
info
.
si_signo
==
signo
)
{
/* In some case, many siginfos have same signo, only last one inserted list need copy to unbinfo. */
if
(
isFirstDel
)
{
/* copy tmpinfo to unbinfo. */
(
VOID
)
memcpy_s
(
&
sigcb
->
sigunbinfo
,
sizeof
(
siginfo_t
),
&
tmpInfoNode
->
info
,
sizeof
(
siginfo_t
));
isFirstDel
=
0
;
}
/* delete tmpinfo from tmpList. */
*
prevHook
=
tmpInfoNode
->
next
;
(
VOID
)
LOS_MemFree
(
m_aucSysMem0
,
tmpInfoNode
);
tmpInfoNode
=
*
prevHook
;
continue
;
}
prevHook
=
&
tmpInfoNode
->
next
;
tmpInfoNode
=
tmpInfoNode
->
next
;
}
return
;
}
STATIC
INT32
OsAddSigInfoToTmpList
(
sig_cb
*
sigcb
,
siginfo_t
*
info
)
{
SigInfoListNode
*
tmp
=
(
SigInfoListNode
*
)
LOS_MemAlloc
(
m_aucSysMem0
,
sizeof
(
SigInfoListNode
));
if
(
tmp
==
NULL
)
{
return
LOS_NOK
;
}
(
VOID
)
memcpy_s
(
&
tmp
->
info
,
sizeof
(
siginfo_t
),
info
,
sizeof
(
siginfo_t
));
tmp
->
next
=
sigcb
->
tmpInfoListHead
;
sigcb
->
tmpInfoListHead
=
tmp
;
return
LOS_OK
;
}
VOID
OsClearSigInfoTmpList
(
sig_cb
*
sigcb
)
{
while
(
sigcb
->
tmpInfoListHead
!=
NULL
)
{
SigInfoListNode
*
tmpInfoNode
=
sigcb
->
tmpInfoListHead
;
sigcb
->
tmpInfoListHead
=
sigcb
->
tmpInfoListHead
->
next
;
(
VOID
)
LOS_MemFree
(
m_aucSysMem0
,
tmpInfoNode
);
}
}
STATIC
INLINE
VOID
OsSigWaitTaskWake
(
LosTaskCB
*
taskCB
,
INT32
signo
)
{
sig_cb
*
sigcb
=
&
taskCB
->
sig
;
if
(
!
LOS_ListEmpty
(
&
sigcb
->
waitList
)
&&
OsSigIsMember
(
&
sigcb
->
sigwaitmask
,
signo
))
{
OsMoveTmpInfoToUnbInfo
(
sigcb
,
signo
);
OsTaskWakeClearPendMask
(
taskCB
);
OsSchedTaskWake
(
taskCB
);
OsSigEmptySet
(
&
sigcb
->
sigwaitmask
);
...
...
@@ -141,7 +190,10 @@ int OsTcbDispatch(LosTaskCB *stcb, siginfo_t *info)
/* unmasked signal actions */
OsSigAddSet
(
&
sigcb
->
sigFlag
,
info
->
si_signo
);
}
(
void
)
memcpy_s
(
&
sigcb
->
sigunbinfo
,
sizeof
(
siginfo_t
),
info
,
sizeof
(
siginfo_t
));
if
(
OsAddSigInfoToTmpList
(
sigcb
,
info
)
==
LOS_NOK
)
{
return
-
ENOMEM
;
}
return
OsPendingTaskWake
(
stcb
,
info
->
si_signo
);
}
...
...
@@ -516,6 +568,7 @@ int OsSigTimedWaitNoLock(sigset_t *set, siginfo_t *info, unsigned int timeout)
if
(
clear
)
{
sigcb
->
sigPendFlag
^=
clear
;
ret
=
FindFirstSetedBit
((
UINT64
)
clear
)
+
1
;
OsMoveTmpInfoToUnbInfo
(
sigcb
,
ret
);
}
else
{
OsSigAddSet
(
set
,
SIGKILL
);
OsSigAddSet
(
set
,
SIGSTOP
);
...
...
@@ -529,7 +582,7 @@ int OsSigTimedWaitNoLock(sigset_t *set, siginfo_t *info, unsigned int timeout)
sigcb
->
sigwaitmask
=
NULL_SIGNAL_SET
;
}
if
(
info
!=
NULL
)
{
(
void
)
memcpy_s
(
info
,
sizeof
(
siginfo_t
),
&
sigcb
->
sigunbinfo
,
sizeof
(
siginfo_t
));
(
VOID
)
memcpy_s
(
info
,
sizeof
(
siginfo_t
),
&
sigcb
->
sigunbinfo
,
sizeof
(
siginfo_t
));
}
return
ret
;
}
...
...
@@ -669,6 +722,7 @@ VOID *OsSaveSignalContext(VOID *sp, VOID *newSp)
sigcb
->
sigFlag
|=
process
->
sigShare
;
UINT32
signo
=
(
UINT32
)
FindFirstSetedBit
(
sigcb
->
sigFlag
)
+
1
;
UINT32
sigVal
=
(
UINT32
)(
UINTPTR
)(
sigcb
->
sigunbinfo
.
si_value
.
sival_ptr
);
OsMoveTmpInfoToUnbInfo
(
sigcb
,
signo
);
OsProcessExitCodeSignalSet
(
process
,
signo
);
sigcb
->
sigContext
=
sp
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录