Changeset 26326 in vbox
- Timestamp:
- Feb 8, 2010 1:22:24 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp
r26054 r26326 158 158 VBGLR3DECL(int) VbglR3CtlFilterMask(uint32_t fOr, uint32_t fNot) 159 159 { 160 #if defined(RT_OS_WINDOWS)161 /** @todo Not yet implemented. */162 return VERR_NOT_SUPPORTED;163 164 #else165 166 160 VBoxGuestFilterMaskInfo Info; 167 161 Info.u32OrMask = fOr; 168 162 Info.u32NotMask = fNot; 169 163 return vbglR3DoIOCtl(VBOXGUEST_IOCTL_CTL_FILTER_MASK, &Info, sizeof(Info)); 170 #endif171 164 } 172 165 … … 196 189 #endif 197 190 return rc; 191 } 192 193 /** 194 * Query the current statistics update interval 195 * 196 * @returns IPRT status code 197 * @param pu32Interval Update interval in ms (out) 198 */ 199 VBGLR3DECL(int) VbglR3StatQueryInterval(uint32_t *pu32Interval) 200 { 201 VMMDevGetStatisticsChangeRequest Req; 202 203 vmmdevInitRequest(&Req.header, VMMDevReq_GetStatisticsChangeRequest); 204 Req.eventAck = VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST; 205 int rc = vbglR3GRPerform(&Req.header); 206 if (RT_SUCCESS(rc)) 207 *pu32Interval = Req.u32StatInterval * 1000; 208 return rc; 209 } 210 211 212 /** 213 * Report guest statistics 214 * 215 * @returns IPRT status code 216 * @param pReq Request packet with statistics 217 */ 218 VBGLR3DECL(int) VbglR3StatReport(VMMDevReportGuestStats *pReq) 219 { 220 vmmdevInitRequest(&pReq->header, VMMDevReq_ReportGuestStats); 221 return vbglR3GRPerform(&pReq->header); 222 } 223 224 225 /** 226 * Refresh the memory balloon after a change 227 * 228 * @returns IPRT status code 229 * @param pu32Size Memory balloon size in MBs (out) 230 */ 231 VBGLR3DECL(int) VbglR3MemBalloonRefresh(uint32_t *pu32Size) 232 { 233 return vbglR3DoIOCtl(VBOXGUEST_IOCTL_CTL_CHECK_BALLOON_MASK, pu32Size, sizeof(*pu32Size)); 198 234 } 199 235 -
trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk
r26292 r26326 34 34 VBoxService_TEMPLATE = VBOXGUESTR3EXE 35 35 VBoxService_DEFS = VBOXSERVICE_TIMESYNC 36 VBoxService_DEFS.win += _WIN32_WINNT=0x0501 37 ##VBOXSERVICE_MANAGEMENT 36 VBoxService_DEFS.win += _WIN32_WINNT=0x0501 VBOXSERVICE_MANAGEMENT 38 37 VBoxService_DEFS.os2 = VBOX_WITH_HGCM VBOXSERVICE_CLIPBOARD 39 38 ifdef VBOX_WITH_GUEST_PROPS … … 67 66 VBoxService_SOURCES.win += \ 68 67 VBoxService-win.rc \ 69 VBoxService-win.cpp 70 71 ## VBoxServiceStats.cpp \ 72 ## VBoxServiceBalloon.cpp 68 VBoxService-win.cpp \ 69 VBoxServiceBalloon.cpp \ 70 VBoxServiceStats.cpp 73 71 74 72 VBoxService_SOURCES.os2 = \ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceBalloon.cpp
r26292 r26326 19 19 * additional information or have any questions. 20 20 */ 21 #define _WIN32_WINNT 0x050022 #include <windows.h>23 #include <psapi.h>24 #include "VBoxTray.h"25 #include "VBoxMemBalloon.h"26 #include <VBoxDisplay.h>27 #include <VBox/VMMDev.h>28 #include <VBoxGuestInternal.h>29 21 #include <iprt/assert.h> 30 #include "helpers.h" 31 #include <winternl.h> 32 33 typedef struct _VBOXMEMBALLOONCONTEXT 34 { 35 const VBOXSERVICEENV *pEnv; 36 uint32_t uMemBalloonSize; 37 } VBOXMEMBALLOONCONTEXT; 22 #include <iprt/mem.h> 23 #include <iprt/thread.h> 24 #include <iprt/string.h> 25 #include <iprt/semaphore.h> 26 #include <iprt/system.h> 27 #include <iprt/time.h> 28 #include <VBox/VBoxGuestLib.h> 29 #include "VBoxServiceInternal.h" 30 #include "VBoxServiceUtils.h" 38 31 39 32 40 static VBOXMEMBALLOONCONTEXT gCtx = {0};41 33 34 /******************************************************************************* 35 * Global Variables * 36 *******************************************************************************/ 37 static uint32_t g_MemBalloonSize = 0; 42 38 43 int VBoxMemBalloonInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread) 39 /** The semaphore we're blocking on. */ 40 static RTSEMEVENTMULTI g_MemBalloonEvent = NIL_RTSEMEVENTMULTI; 41 42 /** @copydoc VBOXSERVICE::pfnPreInit */ 43 static DECLCALLBACK(int) VBoxServiceBalloonPreInit(void) 44 44 { 45 HANDLE gVBoxDriver = pEnv->hDriver;46 DWORD cbReturned;47 48 Log(("VBoxMemBalloonInit: Init\n"));49 50 gCtx.pEnv = pEnv;51 gCtx.uMemBalloonSize = 0;52 53 /* Check balloon size */54 DWORD dwMemBalloonSize;55 if (DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_CTL_CHECK_BALLOON_MASK, NULL, 0, &dwMemBalloonSize, sizeof(dwMemBalloonSize), &cbReturned, NULL))56 {57 Log(("VBoxMemBalloonInit: new balloon size %d MB\n", dwMemBalloonSize));58 gCtx.uMemBalloonSize = dwMemBalloonSize;59 }60 else61 Log(("VBoxMemBalloonInit: DeviceIoControl (balloon) failed with %d\n", GetLastError()));62 63 *pfStartThread = true;64 *ppInstance = &gCtx;65 45 return VINF_SUCCESS; 66 46 } 67 47 68 48 69 void VBoxMemBalloonDestroy(const VBOXSERVICEENV *pEnv, void *pInstance) 49 /** @copydoc VBOXSERVICE::pfnOption */ 50 static DECLCALLBACK(int) VBoxServiceBalloonOption(const char **ppszShort, int argc, char **argv, int *pi) 70 51 { 71 Log(("VBoxMemBalloonDestroy\n")); 52 return VINF_SUCCESS; 53 } 54 55 56 /** @copydoc VBOXSERVICE::pfnInit */ 57 static DECLCALLBACK(int) VBoxServiceBalloonInit(void) 58 { 59 VBoxServiceVerbose(3, "VBoxServiceBalloonInit\n"); 60 61 int rc = RTSemEventMultiCreate(&g_MemBalloonEvent); 62 AssertRCReturn(rc, rc); 63 64 g_MemBalloonSize = 0; 65 66 /* Check balloon size */ 67 rc = VbglR3MemBalloonRefresh(&g_MemBalloonSize); 68 if (RT_SUCCESS(rc)) 69 VBoxServiceVerbose(3, "VBoxMemBalloonInit: new balloon size %d MB\n", g_MemBalloonSize); 70 else 71 VBoxServiceVerbose(3, "VBoxMemBalloonInit: VbglR3MemBalloonRefresh failed with %d\n", rc); 72 73 return rc; 74 } 75 76 77 uint32_t VBoxServiceBalloonQuerySize() 78 { 79 return g_MemBalloonSize; 80 } 81 82 /** @copydoc VBOXSERVICE::pfnWorker */ 83 DECLCALLBACK(int) VBoxServiceBalloonWorker(bool volatile *pfShutdown) 84 { 85 int rc = VINF_SUCCESS; 86 87 /* Start monitoring of the stat event change event. */ 88 rc = VbglR3CtlFilterMask(VMMDEV_EVENT_BALLOON_CHANGE_REQUEST, 0); 89 if (RT_FAILURE(rc)) 90 { 91 VBoxServiceVerbose(3, "VBoxServiceBalloonWorker: VbglR3CtlFilterMask failed with %d\n", rc); 92 return rc; 93 } 94 95 /* 96 * Tell the control thread that it can continue 97 * spawning services. 98 */ 99 RTThreadUserSignal(RTThreadSelf()); 100 101 /* 102 * Now enter the loop retrieving runtime data continuously. 103 */ 104 for (;;) 105 { 106 uint32_t fEvents = 0; 107 108 /* Check if an update interval change is pending. */ 109 rc = VbglR3WaitEvent(VMMDEV_EVENT_BALLOON_CHANGE_REQUEST, 0 /* no wait */, &fEvents); 110 if ( RT_SUCCESS(rc) 111 && (fEvents & VMMDEV_EVENT_BALLOON_CHANGE_REQUEST)) 112 { 113 rc = VbglR3MemBalloonRefresh(&g_MemBalloonSize); 114 if (RT_SUCCESS(rc)) 115 VBoxServiceVerbose(3, "VBoxServiceBalloonWorker: new balloon size %d MB\n", g_MemBalloonSize); 116 else 117 VBoxServiceVerbose(3, "VBoxServiceBalloonWorker: VbglR3MemBalloonRefresh failed with %d\n", rc); 118 } 119 120 /* 121 * Block for a while. 122 * 123 * The event semaphore takes care of ignoring interruptions and it 124 * allows us to implement service wakeup later. 125 */ 126 if (*pfShutdown) 127 break; 128 int rc2 = RTSemEventMultiWait(g_MemBalloonEvent, 5000); 129 if (*pfShutdown) 130 break; 131 if (rc2 != VERR_TIMEOUT && RT_FAILURE(rc2)) 132 { 133 VBoxServiceError("RTSemEventMultiWait failed; rc2=%Rrc\n", rc2); 134 rc = rc2; 135 break; 136 } 137 } 138 139 /* Cancel monitoring of the memory balloon change event. */ 140 rc = VbglR3CtlFilterMask(0, VMMDEV_EVENT_BALLOON_CHANGE_REQUEST); 141 if (RT_FAILURE(rc)) 142 VBoxServiceVerbose(3, "VBoxServiceBalloonWorker: VbglR3CtlFilterMask failed with %d\n", rc); 143 144 RTSemEventMultiDestroy(g_MemBalloonEvent); 145 g_MemBalloonEvent = NIL_RTSEMEVENTMULTI; 146 147 VBoxServiceVerbose(3, "VBoxServiceBalloonWorker: finished mem balloon change request thread\n"); 148 return 0; 149 } 150 151 /** @copydoc VBOXSERVICE::pfnTerm */ 152 static DECLCALLBACK(void) VBoxServiceBalloonTerm(void) 153 { 154 VBoxServiceVerbose(3, "VBoxServiceBalloonTerm\n"); 72 155 return; 73 156 } 74 157 75 uint32_t VBoxMemBalloonQuerySize() 158 159 /** @copydoc VBOXSERVICE::pfnStop */ 160 static DECLCALLBACK(void) VBoxServiceBalloonStop(void) 76 161 { 77 return gCtx.uMemBalloonSize; 78 } 79 80 /** 81 * Thread function to wait for and process seamless mode change 82 * requests 83 */ 84 unsigned __stdcall VBoxMemBalloonThread(void *pInstance) 85 { 86 VBOXMEMBALLOONCONTEXT *pCtx = (VBOXMEMBALLOONCONTEXT *)pInstance; 87 HANDLE gVBoxDriver = pCtx->pEnv->hDriver; 88 bool fTerminate = false; 89 VBoxGuestFilterMaskInfo maskInfo; 90 DWORD cbReturned; 91 92 maskInfo.u32OrMask = VMMDEV_EVENT_BALLOON_CHANGE_REQUEST; 93 maskInfo.u32NotMask = 0; 94 if (DeviceIoControl (gVBoxDriver, VBOXGUEST_IOCTL_CTL_FILTER_MASK, &maskInfo, sizeof (maskInfo), NULL, 0, &cbReturned, NULL)) 95 { 96 Log(("VBoxMemBalloonThread: DeviceIOControl(CtlMask - or) succeeded\n")); 97 } 98 else 99 { 100 Log(("VBoxMemBalloonThread: DeviceIOControl(CtlMask) failed, SeamlessChangeThread exited\n")); 101 return 0; 102 } 103 104 do 105 { 106 /* wait for a seamless change event */ 107 VBoxGuestWaitEventInfo waitEvent; 108 waitEvent.u32TimeoutIn = 5000; 109 waitEvent.u32EventMaskIn = VMMDEV_EVENT_BALLOON_CHANGE_REQUEST; 110 if (DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_WAITEVENT, &waitEvent, sizeof(waitEvent), &waitEvent, sizeof(waitEvent), &cbReturned, NULL)) 111 { 112 Log(("VBoxMemBalloonThread: DeviceIOControl succeded\n")); 113 114 /* are we supposed to stop? */ 115 if (WaitForSingleObject(pCtx->pEnv->hStopEvent, 0) == WAIT_OBJECT_0) 116 break; 117 118 Log(("VBoxMemBalloonThread: checking event\n")); 119 120 /* did we get the right event? */ 121 if (waitEvent.u32EventFlagsOut & VMMDEV_EVENT_BALLOON_CHANGE_REQUEST) 122 { 123 DWORD dwMemBalloonSize; 124 if (DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_CTL_CHECK_BALLOON_MASK, NULL, 0, &dwMemBalloonSize, sizeof(dwMemBalloonSize), &cbReturned, NULL)) 125 { 126 Log(("VBoxMemBalloonThread: new balloon size % MB\n", dwMemBalloonSize)); 127 pCtx->uMemBalloonSize = dwMemBalloonSize; 128 } 129 else 130 Log(("VBoxMemBalloonThread: DeviceIoControl (balloon) failed with %d\n", GetLastError())); 131 } 132 } 133 else 134 { 135 Log(("VBoxMemBalloonThread: error 0 from DeviceIoControl VBOXGUEST_IOCTL_WAITEVENT\n")); 136 137 /* sleep a bit to not eat too much CPU in case the above call always fails */ 138 if (WaitForSingleObject(pCtx->pEnv->hStopEvent, 10) == WAIT_OBJECT_0) 139 { 140 fTerminate = true; 141 break; 142 } 143 } 144 } 145 while (!fTerminate); 146 147 maskInfo.u32OrMask = 0; 148 maskInfo.u32NotMask = VMMDEV_EVENT_BALLOON_CHANGE_REQUEST; 149 if (DeviceIoControl (gVBoxDriver, VBOXGUEST_IOCTL_CTL_FILTER_MASK, &maskInfo, sizeof (maskInfo), NULL, 0, &cbReturned, NULL)) 150 { 151 Log(("VBoxMemBalloonThread: DeviceIOControl(CtlMask - not) succeeded\n")); 152 } 153 else 154 { 155 Log(("VBoxMemBalloonThread: DeviceIOControl(CtlMask) failed\n")); 156 } 157 158 Log(("VBoxMemBalloonThread: finished mem balloon change request thread\n")); 159 return 0; 162 RTSemEventMultiSignal(g_MemBalloonEvent); 160 163 } 161 164 162 165 166 /** 167 * The 'memballoon' service description. 168 */ 169 VBOXSERVICE g_MemBalloon = 170 { 171 /* pszName. */ 172 "memballoon", 173 /* pszDescription. */ 174 "Memory Ballooning", 175 /* pszUsage. */ 176 NULL, 177 /* pszOptions. */ 178 NULL, 179 /* methods */ 180 VBoxServiceBalloonPreInit, 181 VBoxServiceBalloonOption, 182 VBoxServiceBalloonInit, 183 VBoxServiceBalloonWorker, 184 VBoxServiceBalloonStop, 185 VBoxServiceBalloonTerm 186 }; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r26292 r26326 27 27 # include <Windows.h> 28 28 # include <process.h> /* Needed for file version information. */ 29 # include <Ntsecapi.h> /* Needed for process security information. */30 29 #endif 31 30 … … 153 152 #ifdef RT_OS_WINDOWS 154 153 extern DWORD g_rcWinService; 155 extern SERVICE_STATUS_HANDLE g_hWinServiceStatus;156 154 extern SERVICE_TABLE_ENTRY const g_aServiceTable[]; /** @todo generate on the fly, see comment in main() from the enabled sub services. */ 157 155 extern PFNWTSGETACTIVECONSOLESESSIONID g_pfnWTSGetActiveConsoleSessionId; /* VBoxServiceVMInfo-win.cpp */ … … 169 167 #endif /* RT_OS_WINDOWS */ 170 168 169 #ifdef VBOXSERVICE_MANAGEMENT 170 extern uint32_t VBoxServiceBalloonQuerySize(); 171 #endif 172 171 173 RT_C_DECLS_END 172 174 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceStats.cpp
r26299 r26326 19 19 * additional information or have any questions. 20 20 */ 21 #define _WIN32_WINNT 0x050022 21 #include <windows.h> 23 22 #include <psapi.h> 24 #include "VBoxTray.h" 25 #include <VBoxDisplay.h> 26 #include <VBox/VMMDev.h> 27 #include <VBox/VBoxGuest.h> 28 #include <VBoxGuestInternal.h> 23 #include <winternl.h> 24 29 25 #include <iprt/assert.h> 30 #include "helpers.h" 31 #include <winternl.h> 26 #include <iprt/mem.h> 27 #include <iprt/thread.h> 28 #include <iprt/string.h> 29 #include <iprt/semaphore.h> 30 #include <iprt/system.h> 31 #include <iprt/time.h> 32 #include <VBox/VBoxGuestLib.h> 33 #include "VBoxServiceInternal.h" 34 #include "VBoxServiceUtils.h" 32 35 33 36 typedef struct _VBOXSTATSCONTEXT … … 77 80 AssertRCReturn(rc, rc); 78 81 79 gCtx.pEnv = pEnv; 80 gCtx.uStatInterval = 0; /* default */ 82 gCtx.uStatInterval = 0; /* default; update disabled */ 81 83 gCtx.ullLastCpuLoad_Idle = 0; 82 84 gCtx.ullLastCpuLoad_Kernel = 0; 83 85 gCtx.ullLastCpuLoad_User = 0; 84 86 85 VMMDevGetStatisticsChangeRequest req; 86 vmmdevInitRequest(&req.header, VMMDevReq_GetStatisticsChangeRequest); 87 req.eventAck = 0; 88 89 if (DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_VMMREQUEST(req.header.size), &req, req.header.size, &req, req.header.size, &cbReturned, NULL)) 90 { 91 VBoxServiceVerbose(3, "VBoxStatsInit: new statistics interval %d seconds\n", req.u32StatInterval); 92 gCtx.uStatInterval = req.u32StatInterval * 1000; 93 } 87 rc = VbglR3StatQueryInterval(&gCtx.uStatInterval); 88 if (RT_SUCCESS(rc)) 89 VBoxServiceVerbose(3, "VBoxStatsInit: new statistics interval %d seconds\n", gCtx.uStatInterval); 94 90 else 95 VBoxServiceVerbose(3, ("VBoxStatsInit: DeviceIoControl failed with %d\n", GetLastError());91 VBoxServiceVerbose(3, "VBoxStatsInit: DeviceIoControl failed with %d\n", rc); 96 92 97 93 #ifdef RT_OS_WINDOWS … … 139 135 140 136 141 static void VBoxServiceVMStatsReport( VBOXSTATSCONTEXT *pCtx)137 static void VBoxServiceVMStatsReport() 142 138 { 143 139 #ifdef RT_OS_WINDOWS … … 148 144 uint32_t cbStruct; 149 145 DWORD cbReturned; 150 HANDLE gVBoxDriver = pCtx->pEnv->hDriver;151 146 152 147 Assert(gCtx.pfnGlobalMemoryStatusEx && gCtx.pfnNtQuerySystemInformation); … … 154 149 || !gCtx.pfnNtQuerySystemInformation) 155 150 return; 156 157 vmmdevInitRequest(&req.header, VMMDevReq_ReportGuestStats);158 151 159 152 /* Query and report guest statistics */ … … 169 162 req.guestStats.u32PageFileSize = (uint32_t)(memStatus.ullTotalPageFile / systemInfo.dwPageSize) - req.guestStats.u32PhysMemTotal; 170 163 req.guestStats.u32MemoryLoad = memStatus.dwMemoryLoad; 171 req.guestStats.u32PhysMemBalloon = VBox MemBalloonQuerySize() * (_1M/systemInfo.dwPageSize); /* was in megabytes */164 req.guestStats.u32PhysMemBalloon = VBoxServiceBalloonQuerySize() * (_1M/systemInfo.dwPageSize); /* was in megabytes */ 172 165 req.guestStats.u32StatCaps = VBOX_GUEST_STAT_PHYS_MEM_TOTAL | VBOX_GUEST_STAT_PHYS_MEM_AVAIL | VBOX_GUEST_STAT_PAGE_FILE_SIZE | VBOX_GUEST_STAT_MEMORY_LOAD | VBOX_GUEST_STAT_PHYS_MEM_BALLOON; 173 166 … … 189 182 } 190 183 else 191 Log(("GetPerformanceInfo failed with %d\n", GetLastError()));184 VBoxServiceVerbose(3, "GetPerformanceInfo failed with %d\n", GetLastError()); 192 185 } 193 186 … … 238 231 req.guestStats.u32CpuId = i; 239 232 240 if (DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_VMMREQUEST(req.header.size), &req, req.header.size, &req, req.header.size, &cbReturned, NULL)) 241 { 242 Log(("VBoxStatsReportStatistics: new statistics reported successfully!\n")); 243 } 244 else 245 Log(("VBoxStatsReportStatistics: DeviceIoControl (stats report) failed with %d\n", GetLastError())); 233 rc = VbglR3StatReport(&req); 234 if (RT_SUCCESS(rc)) 235 { 236 VBoxServiceVerbose(3, "VBoxStatsReportStatistics: new statistics reported successfully!\n"); 237 } 238 else 239 VBoxServiceVerbose(3, "VBoxStatsReportStatistics: DeviceIoControl (stats report) failed with %d\n", GetLastError()); 246 240 } 247 241 … … 256 250 DECLCALLBACK(int) VBoxServiceVMStatsWorker(bool volatile *pfShutdown) 257 251 { 258 VBOXSTATSCONTEXT *pCtx = (VBOXSTATSCONTEXT *)pInstance;259 HANDLE gVBoxDriver = pCtx->pEnv->hDriver;260 bool fTerminate = false;261 262 252 int rc = VINF_SUCCESS; 253 254 /* Start monitoring of the stat event change event. */ 255 rc = VbglR3CtlFilterMask(VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST, 0); 256 if (RT_FAILURE(rc)) 257 { 258 VBoxServiceVerbose(3, "VBoxServiceVMStatsWorker: VbglR3CtlFilterMask failed with %d\n", rc); 259 return rc; 260 } 263 261 264 262 /* … … 268 266 RTThreadUserSignal(RTThreadSelf()); 269 267 270 rc = VbglR3CtlFilterMask(VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST, 0);271 if (RT_FAILED(rc))272 {273 VBoxServiceVerbose(3, ("VBoxStatsThread: DeviceIOControl(CtlMask) failed, SeamlessChangeThread exited\n");274 return 0;275 }276 277 268 /* 278 269 * Now enter the loop retrieving runtime data continuously. … … 281 272 { 282 273 uint32_t fEvents = 0; 283 284 rc = VbglR3WaitEvent(VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST, 1000, &fEvents); 274 uint32_t u32WaitMillies; 275 276 /* Check if an update interval change is pending. */ 277 rc = VbglR3WaitEvent(VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST, 0 /* no wait */, &fEvents); 285 278 if ( RT_SUCCESS(rc) 286 279 && (fEvents & VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST)) 287 280 { 288 } 289 290 VBoxServiceVMStatsReport(); 281 VbglR3StatQueryInterval(&gCtx.uStatInterval); 282 } 283 284 if (gCtx.uStatInterval) 285 { 286 VBoxServiceVMStatsReport(); 287 u32WaitMillies = gCtx.uStatInterval; 288 } 289 else 290 u32WaitMillies = 3000; 291 291 292 292 /* … … 298 298 if (*pfShutdown) 299 299 break; 300 int rc2 = RTSemEventMultiWait(g_VMStatEvent, g_VMStatsInterval);300 int rc2 = RTSemEventMultiWait(g_VMStatEvent, u32WaitMillies); 301 301 if (*pfShutdown) 302 302 break; … … 309 309 } 310 310 311 /* Cancel monitoring of the stat event change event. */ 311 312 rc = VbglR3CtlFilterMask(0, VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST); 312 if (RT_FAILED(rc)) 313 { 314 VBoxServiceVerbose(3, ("VBoxStatsThread: DeviceIOControl(CtlMask) failed, SeamlessChangeThread exited\n"); 315 return 0; 316 } 317 318 319 RTSemEventMultiDestroy(g_VMStatsEvent); 320 g_VMStatsEvent = NIL_RTSEMEVENTMULTI; 321 322 Log(("VBoxStatsThread: finished statistics change request thread\n")); 313 if (RT_FAILURE(rc)) 314 VBoxServiceVerbose(3, "VBoxServiceVMStatsWorker: VbglR3CtlFilterMask failed with %d\n", rc); 315 316 RTSemEventMultiDestroy(g_VMStatEvent); 317 g_VMStatEvent = NIL_RTSEMEVENTMULTI; 318 319 VBoxServiceVerbose(3, "VBoxStatsThread: finished statistics change request thread\n"); 323 320 return 0; 324 321 } … … 336 333 static DECLCALLBACK(void) VBoxServiceVMStatsStop(void) 337 334 { 338 RTSemEventMultiSignal(g_VMStat sEvent);335 RTSemEventMultiSignal(g_VMStatEvent); 339 336 } 340 337 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
r26136 r26326 27 27 #include <wtsapi32.h> /* For WTS* calls. */ 28 28 #include <psapi.h> /* EnumProcesses. */ 29 #include <Ntsecapi.h> /* Needed for process security information. */ 29 30 30 31 #include <iprt/assert.h>
Note:
See TracChangeset
for help on using the changeset viewer.