Changeset 30957 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- Jul 21, 2010 1:07:34 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r30758 r30957 496 496 int main(int argc, char **argv) 497 497 { 498 int rc = VINF_SUCCESS;499 498 /* 500 499 * Init globals and such. … … 503 502 504 503 /* 505 * Connect to the kernel part before daemonizing so we can fail 506 * and complain if there is some kind of problem. We need to initialize507 * the guest lib *before* we do the pre-init just in case one of services508 * needsdo to some initial stuff with it.504 * Connect to the kernel part before daemonizing so we can fail and 505 * complain if there is some kind of problem. We need to initialize the 506 * guest lib *before* we do the pre-init just in case one of services needs 507 * do to some initial stuff with it. 509 508 */ 510 509 VBoxServiceVerbose(2, "Calling VbgR3Init()\n"); 511 rc = VbglR3Init();510 int rc = VbglR3Init(); 512 511 if (RT_FAILURE(rc)) 513 512 return VBoxServiceError("VbglR3Init failed with rc=%Rrc.\n", rc); 514 513 515 514 #ifdef RT_OS_WINDOWS 516 /* Special forked VBoxService.exe process for handling page fusion. */ 517 /* Note: ugly hack, but annoying to install additional executables. */ 515 /* 516 * Check if we're the specially spawned VBoxService.exe process that 517 * handles page fusion. This saves an extra executable. 518 */ 518 519 if ( argc == 2 519 && !strcmp(argv[1], "-pagefusionfork")) 520 { 520 && !strcmp(argv[1], "--pagefusionfork")) 521 521 return VBoxServicePageSharingInitFork(); 522 } 523 #endif 524 525 /* Do pre-init of services. */ 522 #endif 523 524 /* 525 * Do pre-init of services. 526 */ 526 527 g_pszProgName = RTPathFilename(argv[0]); 527 528 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++) … … 533 534 534 535 #ifdef RT_OS_WINDOWS 535 /* Make sure only one instance of VBoxService runs at a time. Create a global mutex for that. 536 Do not use a global namespace ("Global\\") for mutex name here, will blow up NT4 compatibility! */ 537 HANDLE hMutexAppRunning = CreateMutex (NULL, FALSE, VBOXSERVICE_NAME); 536 /* 537 * Make sure only one instance of VBoxService runs at a time. Create a 538 * global mutex for that. Do not use a global namespace ("Global\\") for 539 * mutex name here, will blow up NT4 compatibility! 540 */ 541 /** @todo r=bird: Use Global\\ prefix or this serves no purpose on terminal servers. */ 542 HANDLE hMutexAppRunning = CreateMutex(NULL, FALSE, VBOXSERVICE_NAME); 538 543 if ( hMutexAppRunning != NULL 539 544 && GetLastError() == ERROR_ALREADY_EXISTS) … … 544 549 CloseHandle(hMutexAppRunning); 545 550 hMutexAppRunning = NULL; 551 552 /** @todo r=bird: How does this cause us to terminate? Btw. Why do 553 * we do this before parsing parameters? 'VBoxService --help' 554 * and 'VBoxService --version' won't work now when the service 555 * is running... */ 546 556 } 547 557 #endif -
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp
r30755 r30957 681 681 VBoxServiceVerbose(3, "VBoxServicePageSharingWorkerProcess: enabled=%d\n", fEnabled); 682 682 683 /* 684 * Start a 2nd VBoxService process to deal with page fusion as we do 685 * not wish to dummy load dlls into this process. (First load with 686 * DONT_RESOLVE_DLL_REFERENCES, 2nd normal -> dll init routines not called!) 687 */ 683 688 if ( fEnabled 684 689 && hProcess == NIL_RTPROCESS) 685 690 { 686 691 char szExeName[256]; 687 char *pszExeName; 688 char *pszArgs[3]; 689 690 pszExeName = RTProcGetExecutableName(szExeName, sizeof(szExeName)); 691 692 char *pszExeName = RTProcGetExecutableName(szExeName, sizeof(szExeName)); 692 693 if (pszExeName) 693 694 { 695 char const *papszArgs[3]; 694 696 pszArgs[0] = pszExeName; 695 pszArgs[1] = "- pagefusionfork";697 pszArgs[1] = "--pagefusionfork"; 696 698 pszArgs[2] = NULL; 697 /* Start a 2nd VBoxService process to deal with page fusion as we do not wish to dummy load 698 * dlls into this process. (first load with DONT_RESOLVE_DLL_REFERENCES, 2nd normal -> dll init routines not called!) 699 */ 700 rc = RTProcCreate(pszExeName, pszArgs, RTENV_DEFAULT, 0 /* normal child */, &hProcess); 701 if (rc != VINF_SUCCESS) 699 rc = RTProcCreate(pszExeName, papszArgs, RTENV_DEFAULT, 0 /* normal child */, &hProcess); 700 if (RT_FAILURE(rc)) 702 701 VBoxServiceError("RTProcCreate %s failed; rc=%Rrc\n", pszExeName, rc); 703 702 }
Note:
See TracChangeset
for help on using the changeset viewer.