Implement LinuxProcess_effectiveIOPriority as function

Make it more readable and fix unenclosed macro arguments
This commit is contained in:
Christian Göttsche
2020-10-27 21:26:39 +01:00
committed by cgzones
parent 6b3dbd5c67
commit d33b2be2ca
2 changed files with 6 additions and 11 deletions

View File

@ -167,7 +167,12 @@ effort class. The priority within the best effort class will be
dynamically derived from the cpu nice level of the process:
io_priority = (cpu_nice + 20) / 5. -- From ionice(1) man page
*/
#define LinuxProcess_effectiveIOPriority(p_) (IOPriority_class(p_->ioPriority) == IOPRIO_CLASS_NONE ? IOPriority_tuple(IOPRIO_CLASS_BE, (p_->super.nice + 20) / 5) : p_->ioPriority)
static int LinuxProcess_effectiveIOPriority(const LinuxProcess* this) {
if (IOPriority_class(this->ioPriority) == IOPRIO_CLASS_NONE)
return IOPriority_tuple(IOPRIO_CLASS_BE, (this->super.nice + 20) / 5);
return this->ioPriority;
}
IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this) {
IOPriority ioprio = 0;