summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_log.h27
-rw-r--r--components/libc/compilers/common/ctime.c7
-rw-r--r--components/lwp/lwp_syscall.c6
3 files changed, 34 insertions, 6 deletions
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_log.h b/bsp/qemu-vexpress-a9/drivers/drv_log.h
new file mode 100644
index 0000000000..ec7ca42c0c
--- /dev/null
+++ b/bsp/qemu-vexpress-a9/drivers/drv_log.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2006-2022, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2022-12-8 zhkag first version
+ */
+
+/*
+ * NOTE: DO NOT include this file on the header file.
+ */
+
+#ifndef LOG_TAG
+#define DBG_TAG "drv"
+#else
+#define DBG_TAG LOG_TAG
+#endif /* LOG_TAG */
+
+#ifdef DRV_DEBUG
+#define DBG_LVL DBG_LOG
+#else
+#define DBG_LVL DBG_INFO
+#endif /* DRV_DEBUG */
+
+#include <rtdbg.h>
diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c
index 493b502534..ace480a54b 100644
--- a/components/libc/compilers/common/ctime.c
+++ b/components/libc/compilers/common/ctime.c
@@ -727,7 +727,7 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
case CLOCK_REALTIME:
{
rt_tick_t tick, tick_old = rt_tick_get();
- if (flags & TIMER_ABSTIME == TIMER_ABSTIME)
+ if ((flags & TIMER_ABSTIME) == TIMER_ABSTIME)
{
tick = (rqtp->tv_sec - _timevalue.tv_sec) * RT_TICK_PER_SECOND + (rqtp->tv_nsec - _timevalue.tv_usec) * (RT_TICK_PER_SECOND / NANOSECOND_PER_SECOND);
rt_tick_t rt_tick = rt_tick_get();
@@ -763,7 +763,7 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
float unit = clock_cpu_getres();
cpu_tick = (rqtp->tv_sec * NANOSECOND_PER_SECOND + rqtp->tv_nsec * (NANOSECOND_PER_SECOND / NANOSECOND_PER_SECOND)) / unit;
- if (flags & TIMER_ABSTIME == TIMER_ABSTIME)
+ if ((flags & TIMER_ABSTIME) == TIMER_ABSTIME)
cpu_tick = cpu_tick < cpu_tick_old ? 0 : cpu_tick - cpu_tick_old;
tick = (unit * cpu_tick) / (NANOSECOND_PER_SECOND / RT_TICK_PER_SECOND);
rt_thread_delay(tick);
@@ -1007,7 +1007,6 @@ RTM_EXPORT(timer_delete);
**/
int timer_getoverrun(timer_t timerid)
{
- struct timer_obj *timer = (struct timer_obj *)((uintptr_t)timerid << 1);
rt_set_errno(ENOSYS);
return -RT_ERROR;
}
@@ -1125,7 +1124,7 @@ int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
* RT_TICK_PER_SECOND NANOSECOND_PER_SECOND NANOSECOND_PER_SECOND
*
*/
- if (flags & TIMER_ABSTIME == TIMER_ABSTIME)
+ if ((flags & TIMER_ABSTIME) == TIMER_ABSTIME)
{
#ifndef RT_USING_RTC
LOG_W(_WARNING_NO_RTC);
diff --git a/components/lwp/lwp_syscall.c b/components/lwp/lwp_syscall.c
index c241e1ef83..0c49e3c960 100644
--- a/components/lwp/lwp_syscall.c
+++ b/components/lwp/lwp_syscall.c
@@ -929,7 +929,8 @@ int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
if ((ret != -1 || rt_get_errno() == EINTR) && rmtp && lwp_user_accessable((void *)rmtp, sizeof *rmtp))
{
lwp_put_to_user(rmtp, (void *)&rmtp_k, sizeof rmtp_k);
- return -EINTR;
+ if(ret != 0)
+ return -EINTR;
}
#else
if (rmtp)
@@ -3878,7 +3879,8 @@ int sys_clock_nanosleep(clockid_t clk, int flags, const struct timespec *rqtp, s
if ((ret != -1 || rt_get_errno() == EINTR) && rmtp && lwp_user_accessable((void *)rmtp, sizeof *rmtp))
{
lwp_put_to_user(rmtp, (void *)&rmtp_k, sizeof rmtp_k);
- return -EINTR;
+ if(ret != 0)
+ return -EINTR;
}
#else
if (rmtp)