MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_timerfd_gettime

Function sys_timerfd_gettime

components/lwp/lwp_syscall.c:10744–10768  ·  view source on GitHub ↗

* @brief Retrieve the current configuration of a timer. * * This function is used to obtain the current expiration time and interval of a timer associated * with a file descriptor created by `sys_timerfd_create`. It allows querying the current state * of the timer, including the time remaining until the next expiration and the period (for periodic timers). * * @param[in] fd The file descr

Source from the content-addressed store, hash-verified

10742 * contain a value of `0`.
10743 */
10744sysret_t sys_timerfd_gettime(int fd, struct itimerspec *cur)
10745{
10746 int ret = -1;
10747 struct itimerspec *kcur;
10748
10749 if (cur == RT_NULL)
10750 return -EINVAL;
10751
10752 if (!lwp_user_accessable((void *)cur, sizeof(struct itimerspec)))
10753 {
10754 return -EFAULT;
10755 }
10756
10757 kcur = kmem_get(sizeof(struct itimerspec));
10758
10759 if (kcur)
10760 {
10761 lwp_get_from_user(kcur, cur, sizeof(struct itimerspec));
10762 ret = timerfd_gettime(fd, kcur);
10763 lwp_put_to_user(cur, kcur, sizeof(struct itimerspec));
10764 kmem_put(kcur);
10765 }
10766
10767 return (ret < 0 ? GET_ERRNO() : ret);
10768}
10769
10770/**
10771 * @brief Create a file descriptor for receiving signals.

Callers

nothing calls this directly

Calls 6

lwp_user_accessableFunction · 0.85
kmem_getFunction · 0.85
lwp_get_from_userFunction · 0.85
timerfd_gettimeFunction · 0.85
lwp_put_to_userFunction · 0.85
kmem_putFunction · 0.85

Tested by

no test coverage detected