getpriority - get the priority of a process or process group.
getpriority() gets the priority of a specified process (by the which and who arguments) compared to the priority of all other processes in the same process group. The return value is the priority value, which ranges from -20 (high priority) to 20 (low priority). It can also be used to get the priority of the specified process relative to the other processes in the same user ID.
This function is useful for allowing privileged processes to set the priority of other processes. It is important to note that the values returned are dependent on the system's scheduling policy, and may not always return meaningful values for a given process.
int[K] - The which argument specifies what information to retrieve. The value PRIO_PROCESS retrieves the priority of the specified process. The value PRIO_PGRP retrieves the priority of the processes in the specified process group.
int[K] - The who argument specifies the process ID or process group ID whose priority should be retrieved.
- K - Originated from kernel-space.
To trace calls to the getpriority() system call.
Example Use Case¶
getpriority() can be used to control the process execution times for tasks with different priorities. For example, when running multiple jobs on a server or setting the priority of processes in a real-time system.
This function is dependent on the system scheduling policy, which may not always return meaningful values for a given process.
- setpriority() - set the priority of a process or process group.
This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.