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

Function sys_setitimer

components/lwp/lwp_syscall.c:10859–10876  ·  view source on GitHub ↗

* @brief Set the value of an interval timer. * * This function is used to set the value of a specified timer that generates periodic signals * after the specified intervals. The timer can be configured to generate a signal when it expires, * and it can be used for tasks like scheduling periodic events. * * @param[in] which Specifies which timer to set. Possible values include: *

Source from the content-addressed store, hash-verified

10857 * @see sys_getitimer(), sigaction(), alarm(), setitimer().
10858 */
10859sysret_t sys_setitimer(int which, const struct itimerspec *restrict new, struct itimerspec *restrict old)
10860{
10861 sysret_t rc = 0;
10862 rt_lwp_t lwp = lwp_self();
10863 struct itimerspec new_value_k;
10864 struct itimerspec old_value_k;
10865
10866 if (lwp_get_from_user(&new_value_k, (void *)new, sizeof(*new)) != sizeof(*new))
10867 {
10868 return -EFAULT;
10869 }
10870
10871 rc = lwp_signal_setitimer(lwp, which, &new_value_k, &old_value_k);
10872 if (old && lwp_put_to_user(old, (void *)&old_value_k, sizeof old_value_k) != sizeof old_value_k)
10873 return -EFAULT;
10874
10875 return rc;
10876}
10877
10878/**
10879 * @brief Set the robust list for the current thread.

Callers

nothing calls this directly

Calls 4

lwp_selfFunction · 0.85
lwp_get_from_userFunction · 0.85
lwp_signal_setitimerFunction · 0.85
lwp_put_to_userFunction · 0.85

Tested by

no test coverage detected