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

Function sys_sched_getparam

components/lwp/lwp_syscall.c:8835–8866  ·  view source on GitHub ↗

* @brief Retrieve the scheduling parameters of a specific thread. * * This function retrieves the scheduling parameters of the thread identified by the thread ID (`tid`). * The retrieved parameters are stored in the structure pointed to by the `param` argument. * * @param[in] tid The thread ID of the target thread whose scheduling parameters are to be retrieved. * @param[out] param A poin

Source from the content-addressed store, hash-verified

8833 * The exact structure and fields of `param` depend on the system's implementation and scheduling policies.
8834 */
8835sysret_t sys_sched_getparam(const pid_t tid, void *param)
8836{
8837 struct sched_param *sched_param = RT_NULL;
8838 rt_thread_t thread;
8839 int ret = -1;
8840
8841 if (!lwp_user_accessable(param, sizeof(struct sched_param)))
8842 {
8843 return -EFAULT;
8844 }
8845
8846 sched_param = kmem_get(sizeof(struct sched_param));
8847 if (sched_param == RT_NULL)
8848 {
8849 return -ENOMEM;
8850 }
8851
8852 thread = lwp_tid_get_thread_and_inc_ref(tid);
8853
8854 if (thread)
8855 {
8856 sched_param->sched_priority = RT_SCHED_PRIV(thread).current_priority;
8857 ret = 0;
8858 }
8859
8860 lwp_tid_dec_ref(thread);
8861
8862 lwp_put_to_user((void *)param, sched_param, sizeof(struct sched_param));
8863 kmem_put(sched_param);
8864
8865 return ret;
8866}
8867
8868/**
8869 * @brief Get the maximum priority for a given scheduling policy.

Callers

nothing calls this directly

Calls 6

lwp_user_accessableFunction · 0.85
kmem_getFunction · 0.85
lwp_tid_dec_refFunction · 0.85
lwp_put_to_userFunction · 0.85
kmem_putFunction · 0.85

Tested by

no test coverage detected