20#include <sys/resource.h>
24#include <sys/syscall.h>
32#ifndef IOPRIO_CLASS_IDLE
41#ifndef IOPRIO_WHO_PROCESS
43 IOPRIO_WHO_PROCESS = 1,
49#ifndef IOPRIO_CLASS_SHIFT
50 const int IOPRIO_CLASS_SHIFT = 13;
58 if ( syscall( SYS_ioprio_set, IOPRIO_WHO_PROCESS, 0, IOPRIO_CLASS_IDLE<<IOPRIO_CLASS_SHIFT ) < 0 ) {
59 qDebug(
"cannot set io scheduling to idle (%s). Trying best effort.\n", strerror( errno ));
60 if ( syscall( SYS_ioprio_set, IOPRIO_WHO_PROCESS, 0, 7|IOPRIO_CLASS_BE<<IOPRIO_CLASS_SHIFT ) < 0 ) {
61 qDebug(
"cannot set io scheduling to best effort.\n");
74 return !setpriority( PRIO_PROCESS, 0, 19 );
80bool lowerSchedulingPriority()
83 struct sched_param param;
84 memset( ¶m, 0,
sizeof(param) );
85 param.sched_priority = 0;
86 return !sched_setscheduler( 0, SCHED_BATCH, ¶m );
92bool setIdleSchedulingPriority()
95 struct sched_param param;
96 memset( ¶m, 0,
sizeof(param) );
97 param.sched_priority = 0;
98 return !sched_setscheduler( 0, SCHED_IDLE, ¶m );
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:58 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.