代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/kernel_liteos_a 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
diff --git a/compat/posix/src/time.c b/compat/posix/src/time.c
index 9935914..7e5da23 100644
--- a/compat/posix/src/time.c
+++ b/compat/posix/src/time.c
@@ -719,6 +719,7 @@ typedef struct {
static VOID SwtmrProc(UINTPTR tmrArg)
{
+#ifdef LOSCFG_KERNEL_VM
INT32 sig, ret;
UINT32 intSave;
pid_t pid;
@@ -763,13 +764,16 @@ static VOID SwtmrProc(UINTPTR tmrArg)
EXIT:
PRINT_ERR("Dispatch signals failed!, ret: %d\r\n", ret);
return;
+#endif
}
int timer_create(clockid_t clockID, struct sigevent *restrict evp, timer_t *restrict timerID)
{
UINT32 ret;
UINT16 swtmrID;
- UINTPTR *arg = NULL;
+#ifdef LOSCFG_SECURITY_VID
+ UINT16 vid;
+#endif
if (!timerID || (clockID != CLOCK_REALTIME) || !evp) {
errno = EINVAL;
@@ -781,20 +785,21 @@ int timer_create(clockid_t clockID, struct sigevent *restrict evp, timer_t *rest
return -1;
}
- arg = (UINTPTR *)malloc(sizeof(UINTPTR));
- if (arg == NULL) {
- errno = ENOMEM;
- return -1;
- }
-
- arg = evp ? evp->sigev_value.sival_ptr : NULL;
- ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)evp->sigev_notify_function, &swtmrID, (UINTPTR)arg);
+ ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)evp->sigev_notify_function, &swtmrID,
+ (UINTPTR)evp->sigev_value.sival_ptr);
if (ret != LOS_OK) {
errno = (ret == LOS_ERRNO_SWTMR_MAXSIZE) ? EAGAIN : EINVAL;
- free(arg);
return -1;
}
+#ifdef LOSCFG_SECURITY_VID
+ vid = AddNodeByRid(swtmrID);
+ if (vid == MAX_INVALID_TIMER_VID) {
+ (VOID)LOS_SwtmrDelete(swtmrID);
+ return -1;
+ }
+ swtmrID = vid;
+#endif
*timerID = (timer_t)(UINTPTR)swtmrID;
return 0;
}
@@ -858,6 +863,7 @@ int timer_delete(timer_t timerID)
{
UINT16 swtmrID = (UINT16)(UINTPTR)timerID;
VOID *arg = NULL;
+ UINTPTR swtmrProc;
#ifdef LOSCFG_SECURITY_VID
swtmrID = GetRidByVid(swtmrID);
@@ -867,10 +873,11 @@ int timer_delete(timer_t timerID)
}
arg = (VOID *)OS_SWT_FROM_SID(swtmrID)->uwArg;
+ swtmrProc = (UINTPTR)OS_SWT_FROM_SID(swtmrID)->pfnHandler;
if (LOS_SwtmrDelete(swtmrID)) {
goto ERROUT;
}
- if (arg != NULL) {
+ if ((swtmrProc == (UINTPTR)SwtmrProc) && (arg != NULL)) {
free(arg);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。