* @brief Retrieves the priority of a process or process group. * * This system call returns the priority of a process or a process group, depending on * the value of the `which` argument. * * @param which The entity for which the priority is being requested. Possible values include: * - `PRIO_PROCESS`: Retrieves the priority of the process specified by `who`. * - `
| 1566 | * @see setpriority(), getpid(), getppid() |
| 1567 | */ |
| 1568 | sysret_t sys_getpriority(int which, id_t who) |
| 1569 | { |
| 1570 | long prio = 0xff; |
| 1571 | |
| 1572 | if (which == PRIO_PROCESS) |
| 1573 | { |
| 1574 | struct rt_lwp *lwp = RT_NULL; |
| 1575 | |
| 1576 | lwp_pid_lock_take(); |
| 1577 | lwp = lwp_from_pid_locked(who); |
| 1578 | |
| 1579 | if (lwp) |
| 1580 | { |
| 1581 | rt_thread_t thread = rt_list_entry(lwp->t_grp.prev, struct rt_thread, sibling); |
| 1582 | prio = RT_SCHED_PRIV(thread).current_priority; |
| 1583 | } |
| 1584 | |
| 1585 | lwp_pid_lock_release(); |
| 1586 | } |
| 1587 | |
| 1588 | return prio; |
| 1589 | } |
| 1590 | |
| 1591 | /** |
| 1592 | * @brief Sets the priority of a process, process group, or user. |
nothing calls this directly
no test coverage detected