* @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
| 8833 | * The exact structure and fields of `param` depend on the system's implementation and scheduling policies. |
| 8834 | */ |
| 8835 | sysret_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. |
nothing calls this directly
no test coverage detected