From 37f582326c1c5d5363a988f7038af0b62d0fb3ea Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 1 Apr 2009 18:29:15 +0000 Subject: [PATCH] windows-afsd-priority-class-20090401 LICENSE MIT Change the default priority class for afsd_service.exe to High. This matches the priority class assigned to other system processes that generate requests to afsd_service.exe. Permit the ..\TransarcAFSDaemon\Parameters "PriorityClass" registry value to be used to change the default. --- src/WINNT/afsd/afsd_init.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index d31233fedc..ec603a24ea 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -617,6 +617,7 @@ int afsd_InitCM(char **reasonP) int cm_SubnetMask[CM_MAXINTERFACE_ADDR];/* client's subnet mask in host order*/ int cm_NetMtu[CM_MAXINTERFACE_ADDR]; /* client's MTU sizes */ int cm_NetFlags[CM_MAXINTERFACE_ADDR]; /* network flags */ + DWORD dwPriority; WSAStartup(0x0101, &WSAjunk); @@ -666,6 +667,16 @@ int afsd_InitCM(char **reasonP) osi_panic(buf, __FILE__, __LINE__); } + dummyLen = sizeof(dwPriority); + code = RegQueryValueEx(parmKey, "PriorityClass", NULL, NULL, + (BYTE *) &dwPriority, &dummyLen); + if (code != ERROR_SUCCESS || dwPriority == 0) { + dwPriority = HIGH_PRIORITY_CLASS; + } + if (dwPriority != GetPriorityClass(GetCurrentProcess())) + SetPriorityClass(GetCurrentProcess(), dwPriority); + afsi_log("PriorityClass 0x%x", GetPriorityClass(GetCurrentProcess())); + dummyLen = sizeof(lockOrderValidation); code = RegQueryValueEx(parmKey, "LockOrderValidation", NULL, NULL, (BYTE *) &lockOrderValidation, &dummyLen);