sched-linux.cpp revision 0ff7152ccdcc57edca12c5f17b9699c66eeff975
2N/A * available from http://www.virtualbox.org. This file is free software;
2N/A * Clara, CA 95054 USA or visit http://www.sun.com if you need
2N/A#ifdef __DOXYGEN__
2N/A# define THREAD_LOGGING
2N/Atypedef struct PROCPRIORITYTYPE
int iPriority;
const char *pszName;
int iNice;
int iDelta;
} PROCPRIORITY;
int iPriority;
int iPolicy;
int iPthreadPolicy;
{ RTTHREADTYPE_DEFAULT, 0 },
{ RTTHREADTYPE_GUI, 0 },
{ RTTHREADTYPE_MAIN_WORKER, 0 },
{ RTTHREADTYPE_DEFAULT, 0 },
{ RTTHREADTYPE_GUI, 0 },
{ RTTHREADTYPE_MAIN_WORKER, 0 },
{ RTTHREADTYPE_VRDP_IO, 0 },
{ RTTHREADTYPE_DEBUGGER, 0 },
{ RTTHREADTYPE_MSG_PUMP, 0 },
{ RTTHREADTYPE_IO, 0 },
{ RTTHREADTYPE_TIMER, 0 }
{ RTTHREADTYPE_INFREQUENT_POLLER, 0 },
{ RTTHREADTYPE_MAIN_HEAVY_WORKER, 0 },
{ RTTHREADTYPE_EMULATION, 0 },
{ RTTHREADTYPE_DEFAULT, 0 },
{ RTTHREADTYPE_GUI, 0 },
{ RTTHREADTYPE_MAIN_WORKER, 0 },
{ RTTHREADTYPE_VRDP_IO, 0 },
{ RTTHREADTYPE_DEBUGGER, 0 },
{ RTTHREADTYPE_MSG_PUMP, 0 },
{ RTTHREADTYPE_IO, 0 },
{ RTTHREADTYPE_TIMER, 0 }
static bool g_fCanRaisePriority = false;
static bool g_fCanRestorePriority = false;
static bool g_fScrewedUpMaxPriorityLimitInheritance = true;
static int g_iMaxPriority = 0;
static bool g_fInitialized = false;
errno = 0;
errno = 0;
errno = 0;
if (!rc)
if (!rc)
if (!rc)
if (!rc)
if (rc)
static void rtSchedDumpPriority(void)
#ifdef THREAD_LOGGING
Log(("Priority: g_fCanRaisePriority=%RTbool g_fCanRestorePriority=%RTbool g_fScrewedUpMaxPriorityLimitInheritance=%RTbool\n",
Log(("Priority: %2d INFREQUENT_POLLER = %d\n", RTTHREADTYPE_INFREQUENT_POLLER, g_pProcessPriority->paTypes[RTTHREADTYPE_INFREQUENT_POLLER].iPriority));
Log(("Priority: %2d MAIN_HEAVY_WORKER = %d\n", RTTHREADTYPE_MAIN_HEAVY_WORKER, g_pProcessPriority->paTypes[RTTHREADTYPE_MAIN_HEAVY_WORKER].iPriority));
Log(("Priority: %2d EMULATION = %d\n", RTTHREADTYPE_EMULATION , g_pProcessPriority->paTypes[RTTHREADTYPE_EMULATION ].iPriority));
Log(("Priority: %2d DEFAULT = %d\n", RTTHREADTYPE_DEFAULT , g_pProcessPriority->paTypes[RTTHREADTYPE_DEFAULT ].iPriority));
Log(("Priority: %2d GUI = %d\n", RTTHREADTYPE_GUI , g_pProcessPriority->paTypes[RTTHREADTYPE_GUI ].iPriority));
Log(("Priority: %2d MAIN_WORKER = %d\n", RTTHREADTYPE_MAIN_WORKER , g_pProcessPriority->paTypes[RTTHREADTYPE_MAIN_WORKER ].iPriority));
Log(("Priority: %2d VRDP_IO = %d\n", RTTHREADTYPE_VRDP_IO , g_pProcessPriority->paTypes[RTTHREADTYPE_VRDP_IO ].iPriority));
Log(("Priority: %2d DEBUGGER = %d\n", RTTHREADTYPE_DEBUGGER , g_pProcessPriority->paTypes[RTTHREADTYPE_DEBUGGER ].iPriority));
Log(("Priority: %2d MSG_PUMP = %d\n", RTTHREADTYPE_MSG_PUMP , g_pProcessPriority->paTypes[RTTHREADTYPE_MSG_PUMP ].iPriority));
Log(("Priority: %2d IO = %d\n", RTTHREADTYPE_IO , g_pProcessPriority->paTypes[RTTHREADTYPE_IO ].iPriority));
Log(("Priority: %2d TIMER = %d\n", RTTHREADTYPE_TIMER , g_pProcessPriority->paTypes[RTTHREADTYPE_TIMER ].iPriority));
int i = iStart;
i = iStart;
g_fCanRestorePriority = false;
return (void *)VINF_SUCCESS;
if (!g_fInitialized)
#ifdef RLIMIT_RTPRIO
return rc;
g_fInitialized = true;
return VINF_SUCCESS;
int i = RTTHREADTYPE_END;
while (--i > RTTHREADTYPE_INVALID)
return (void *)rc;
#ifdef THREAD_LOGGING
return rc;
AssertMsg(iPriority == getpriority(PRIO_PROCESS, 0), ("iPriority=%d getpriority()=%d\n", iPriority, getpriority(PRIO_PROCESS, 0)));
#ifdef THREAD_LOGGING
Log(("rtThreadNativeSetPriority: Thread=%p enmType=%d iPriority=%d pid=%d\n", pThread->Core.Key, enmType, iPriority, getpid()));
return rc;