commit
7676cdb886
|
@ -71,37 +71,44 @@ STATIC VOID OsMoveTmpInfoToUnbInfo(sig_cb *sigcb, INT32 signo)
|
||||||
{
|
{
|
||||||
SigInfoListNode *tmpInfoNode = sigcb->tmpInfoListHead;
|
SigInfoListNode *tmpInfoNode = sigcb->tmpInfoListHead;
|
||||||
SigInfoListNode **prevHook = &sigcb->tmpInfoListHead;
|
SigInfoListNode **prevHook = &sigcb->tmpInfoListHead;
|
||||||
INT32 isFirstDel = 1;
|
|
||||||
while (tmpInfoNode != NULL) {
|
while (tmpInfoNode != NULL) {
|
||||||
if (tmpInfoNode->info.si_signo == signo) {
|
if (tmpInfoNode->info.si_signo == signo) {
|
||||||
/* In some case, many siginfos have same signo, only last one inserted list need copy to unbinfo. */
|
/* copy tmpinfo to unbinfo. */
|
||||||
if (isFirstDel) {
|
(VOID)memcpy_s(&sigcb->sigunbinfo, sizeof(siginfo_t), &tmpInfoNode->info, sizeof(siginfo_t));
|
||||||
/* copy tmpinfo to unbinfo. */
|
/* delete tmpinfo from tmpList. */
|
||||||
(VOID)memcpy_s(&sigcb->sigunbinfo, sizeof(siginfo_t), &tmpInfoNode->info, sizeof(siginfo_t));
|
|
||||||
isFirstDel = 0;
|
|
||||||
}
|
|
||||||
/* delete tmpinfo from tmpList. */
|
|
||||||
*prevHook = tmpInfoNode->next;
|
*prevHook = tmpInfoNode->next;
|
||||||
(VOID)LOS_MemFree(m_aucSysMem0, tmpInfoNode);
|
(VOID)LOS_MemFree(m_aucSysMem0, tmpInfoNode);
|
||||||
tmpInfoNode = *prevHook;
|
tmpInfoNode = *prevHook;
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
prevHook = &tmpInfoNode->next;
|
prevHook = &tmpInfoNode->next;
|
||||||
tmpInfoNode = tmpInfoNode->next;
|
tmpInfoNode = tmpInfoNode->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC INT32 OsAddSigInfoToTmpList(sig_cb *sigcb, siginfo_t *info)
|
STATIC INT32 OsAddSigInfoToTmpList(sig_cb *sigcb, siginfo_t *info)
|
||||||
{
|
{
|
||||||
SigInfoListNode *tmp = (SigInfoListNode *)LOS_MemAlloc(m_aucSysMem0, sizeof(SigInfoListNode));
|
/* try to find the old siginfo */
|
||||||
if (tmp == NULL) {
|
SigInfoListNode *tmp = sigcb->tmpInfoListHead;
|
||||||
return LOS_NOK;
|
while (tmp != NULL) {
|
||||||
|
if (tmp->info.si_signo == info->si_signo) {
|
||||||
|
/* found it, break. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmp == NULL) {
|
||||||
|
/* none, alloc new one */
|
||||||
|
tmp = (SigInfoListNode *)LOS_MemAlloc(m_aucSysMem0, sizeof(SigInfoListNode));
|
||||||
|
if (tmp == NULL) {
|
||||||
|
return LOS_NOK;
|
||||||
|
}
|
||||||
|
tmp->next = sigcb->tmpInfoListHead;
|
||||||
|
sigcb->tmpInfoListHead = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
(VOID)memcpy_s(&tmp->info, sizeof(siginfo_t), info, sizeof(siginfo_t));
|
(VOID)memcpy_s(&tmp->info, sizeof(siginfo_t), info, sizeof(siginfo_t));
|
||||||
tmp->next = sigcb->tmpInfoListHead;
|
|
||||||
sigcb->tmpInfoListHead = tmp;
|
|
||||||
|
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue