Changeset 51564 in vbox for trunk/src/VBox
- Timestamp:
- Jun 6, 2014 8:34:30 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94222
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r51503 r51564 490 490 if (!g_aServices[j].fPreInited) 491 491 { 492 if (g_aServices[j].pDesc->pfnPreInit != NULL) 493 { 494 int rc = g_aServices[j].pDesc->pfnPreInit(); 495 if (RT_FAILURE(rc)) 496 return VBoxServiceError("Service '%s' failed pre-init: %Rrc\n", 497 g_aServices[j].pDesc->pszName, rc); 498 } 492 int rc = g_aServices[j].pDesc->pfnPreInit(); 493 if (RT_FAILURE(rc)) 494 return VBoxServiceError("Service '%s' failed pre-init: %Rrc\n", g_aServices[j].pDesc->pszName, rc); 499 495 g_aServices[j].fPreInited = true; 500 496 } … … 560 556 VBoxServiceVerbose(2, "Initializing services ...\n"); 561 557 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++) 562 if (g_aServices[j].fEnabled && g_aServices[j].pDesc->pfnInit != NULL)558 if (g_aServices[j].fEnabled) 563 559 { 564 560 rc = g_aServices[j].pDesc->pfnInit(); … … 605 601 * to exit the loop before we skipped the fShutdown check 606 602 * below the service will fail to start! */ 607 /** @todo This presumably means either a one-shot service or that608 * something has gone wrong. In the second case treating it as failure609 * to start is probably right, so we need a way to signal the first. */610 603 RTThreadUserWait(g_aServices[j].Thread, 60 * 1000); 611 604 if (g_aServices[j].fShutdown) … … 647 640 */ 648 641 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++) 649 if (g_aServices[j].fStarted && g_aServices[j].pDesc->pfnStop != NULL)642 if (g_aServices[j].fStarted) 650 643 { 651 644 VBoxServiceVerbose(3, "Calling stop function for service '%s' ...\n", g_aServices[j].pDesc->pszName); … … 663 656 if (!g_aServices[j].fEnabled) /* Only stop services which were started before. */ 664 657 continue; 665 if ( g_aServices[j].Thread != NIL_RTTHREAD 666 && g_aServices[j].pDesc->pfnStop != NULL) 658 if (g_aServices[j].Thread != NIL_RTTHREAD) 667 659 { 668 660 VBoxServiceVerbose(2, "Waiting for service '%s' to stop ...\n", g_aServices[j].pDesc->pszName); … … 684 676 } 685 677 } 686 if (g_aServices[j].pDesc->pfnTerm != NULL) 687 { 688 VBoxServiceVerbose(3, "Terminating service '%s' (%d) ...\n", 689 g_aServices[j].pDesc->pszName, j); 690 g_aServices[j].pDesc->pfnTerm(); 691 } 678 VBoxServiceVerbose(3, "Terminating service '%s' (%d) ...\n", g_aServices[j].pDesc->pszName, j); 679 g_aServices[j].pDesc->pfnTerm(); 692 680 } 693 681 … … 918 906 for (unsigned j = 0; !fFound && j < RT_ELEMENTS(g_aServices); j++) 919 907 { 920 if (g_aServices[j].pDesc->pfnOption == NULL)921 continue;922 908 rc = g_aServices[j].pDesc->pfnOption(NULL, argc, argv, &i); 923 909 fFound = rc == VINF_SUCCESS; … … 991 977 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++) 992 978 { 993 if (g_aServices[j].pDesc->pfnOption == NULL)994 continue;995 979 rc = g_aServices[j].pDesc->pfnOption(&psz, argc, argv, &i); 996 980 fFound = rc == VINF_SUCCESS; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
r51503 r51564 68 68 /** The Shared Folders service client ID. */ 69 69 static uint32_t g_SharedFoldersSvcClientID = 0; 70 71 /** @copydoc VBOXSERVICE::pfnPreInit */ 72 static DECLCALLBACK(int) VBoxServiceAutoMountPreInit(void) 73 { 74 return VINF_SUCCESS; 75 } 76 77 78 /** @copydoc VBOXSERVICE::pfnOption */ 79 static DECLCALLBACK(int) VBoxServiceAutoMountOption(const char **ppszShort, int argc, char **argv, int *pi) 80 { 81 NOREF(ppszShort); 82 NOREF(argc); 83 NOREF(argv); 84 NOREF(pi); 85 86 return -1; 87 } 88 70 89 71 90 /** @copydoc VBOXSERVICE::pfnInit */ … … 599 618 NULL, 600 619 /* methods */ 601 /* pfnPreInit */ 602 NULL, 603 /* pfnOption */ 604 NULL, 620 VBoxServiceAutoMountPreInit, 621 VBoxServiceAutoMountOption, 605 622 VBoxServiceAutoMountInit, 606 623 VBoxServiceAutoMountWorker, -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceBalloon.cpp
r51503 r51564 224 224 225 225 return VINF_SUCCESS; 226 } 227 228 229 /** @copydoc VBOXSERVICE::pfnPreInit */ 230 static DECLCALLBACK(int) VBoxServiceBalloonPreInit(void) 231 { 232 return VINF_SUCCESS; 233 } 234 235 236 /** @copydoc VBOXSERVICE::pfnOption */ 237 static DECLCALLBACK(int) VBoxServiceBalloonOption(const char **ppszShort, int argc, char **argv, int *pi) 238 { 239 NOREF(ppszShort); 240 NOREF(argc); 241 NOREF(argv); 242 NOREF(pi); 243 244 return -1; 226 245 } 227 246 … … 377 396 } 378 397 398 /** @copydoc VBOXSERVICE::pfnTerm */ 399 static DECLCALLBACK(void) VBoxServiceBalloonTerm(void) 400 { 401 VBoxServiceVerbose(3, "VBoxServiceBalloonTerm\n"); 402 return; 403 } 404 379 405 380 406 /** @copydoc VBOXSERVICE::pfnStop */ … … 399 425 NULL, 400 426 /* methods */ 401 /* pfnPreInit */ 402 NULL, 403 /* pfnOption */ 404 NULL, 427 VBoxServiceBalloonPreInit, 428 VBoxServiceBalloonOption, 405 429 VBoxServiceBalloonInit, 406 430 VBoxServiceBalloonWorker, 407 431 VBoxServiceBalloonStop, 408 /* pfnTerm */ 409 NULL 432 VBoxServiceBalloonTerm 410 433 }; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp
r51503 r51564 395 395 } 396 396 #endif /* RT_OS_LINUX */ 397 398 399 /** @copydoc VBOXSERVICE::pfnPreInit */ 400 static DECLCALLBACK(int) VBoxServiceCpuHotPlugPreInit(void) 401 { 402 return VINF_SUCCESS; 403 } 404 405 406 /** @copydoc VBOXSERVICE::pfnOption */ 407 static DECLCALLBACK(int) VBoxServiceCpuHotPlugOption(const char **ppszShort, int argc, char **argv, int *pi) 408 { 409 NOREF(ppszShort); 410 NOREF(argc); 411 NOREF(argv); 412 NOREF(pi); 413 414 return -1; 415 } 416 417 418 /** @copydoc VBOXSERVICE::pfnInit */ 419 static DECLCALLBACK(int) VBoxServiceCpuHotPlugInit(void) 420 { 421 return VINF_SUCCESS; 422 } 397 423 398 424 … … 594 620 595 621 622 /** @copydoc VBOXSERVICE::pfnTerm */ 623 static DECLCALLBACK(void) VBoxServiceCpuHotPlugTerm(void) 624 { 625 return; 626 } 627 628 596 629 /** 597 630 * The 'timesync' service description. … … 608 641 NULL, 609 642 /* methods */ 610 /* pfnPreInit */ 611 NULL, 612 /* pfnOption */ 613 NULL, 614 /* pnfInit */ 615 NULL, 643 VBoxServiceCpuHotPlugPreInit, 644 VBoxServiceCpuHotPlugOption, 645 VBoxServiceCpuHotPlugInit, 616 646 VBoxServiceCpuHotPlugWorker, 617 647 VBoxServiceCpuHotPlugStop, 618 /* pfnTerm */ 619 NULL 648 VBoxServiceCpuHotPlugTerm 620 649 }; 621 650 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r51503 r51564 46 46 47 47 /** 48 * Called before parsing arguments. Optional.48 * Called before parsing arguments. 49 49 * @returns VBox status code. 50 50 */ … … 52 52 53 53 /** 54 * Tries to parse the given command line option. Optional.54 * Tries to parse the given command line option. 55 55 * 56 56 * @returns 0 if we parsed, -1 if it didn't and anything else means exit. … … 64 64 65 65 /** 66 * Called before parsing arguments. Optional.66 * Called before parsing arguments. 67 67 * @returns VBox status code. 68 68 */ … … 79 79 80 80 /** 81 * Stop an service. If the service can safely be stopped at any time this 82 * may be left NULL. 81 * Stop an service. 83 82 */ 84 83 DECLCALLBACKMEMBER(void, pfnStop)(void); 85 84 86 85 /** 87 * Does termination cleanups. Optional.86 * Does termination cleanups. 88 87 * 89 88 * @remarks This may be called even if pfnInit hasn't been called! -
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp
r51503 r51564 525 525 #endif 526 526 527 /** @copydoc VBOXSERVICE::pfnPreInit */ 528 static DECLCALLBACK(int) VBoxServicePageSharingPreInit(void) 529 { 530 return VINF_SUCCESS; 531 } 532 533 534 /** @copydoc VBOXSERVICE::pfnOption */ 535 static DECLCALLBACK(int) VBoxServicePageSharingOption(const char **ppszShort, int argc, char **argv, int *pi) 536 { 537 NOREF(ppszShort); 538 NOREF(argc); 539 NOREF(argv); 540 NOREF(pi); 541 542 return -1; 543 } 544 545 527 546 /** @copydoc VBOXSERVICE::pfnInit */ 528 547 static DECLCALLBACK(int) VBoxServicePageSharingInit(void) … … 712 731 #endif /* RT_OS_WINDOWS */ 713 732 733 /** @copydoc VBOXSERVICE::pfnTerm */ 734 static DECLCALLBACK(void) VBoxServicePageSharingTerm(void) 735 { 736 VBoxServiceVerbose(3, "VBoxServicePageSharingTerm\n"); 737 } 738 739 714 740 /** @copydoc VBOXSERVICE::pfnStop */ 715 741 static DECLCALLBACK(void) VBoxServicePageSharingStop(void) … … 733 759 NULL, 734 760 /* methods */ 735 /* pfnPreInit */ 736 NULL, 737 /* pfnOption */ 738 NULL, 761 VBoxServicePageSharingPreInit, 762 VBoxServicePageSharingOption, 739 763 VBoxServicePageSharingInit, 740 764 #ifdef RT_OS_WINDOWS … … 744 768 #endif 745 769 VBoxServicePageSharingStop, 746 /* pfnTerm */ 747 NULL 770 VBoxServicePageSharingTerm 748 771 }; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceStats.cpp
r51503 r51564 83 83 /** The semaphore we're blocking on. */ 84 84 static RTSEMEVENTMULTI g_VMStatEvent = NIL_RTSEMEVENTMULTI; 85 86 87 /** @copydoc VBOXSERVICE::pfnPreInit */ 88 static DECLCALLBACK(int) VBoxServiceVMStatsPreInit(void) 89 { 90 return VINF_SUCCESS; 91 } 92 93 94 /** @copydoc VBOXSERVICE::pfnOption */ 95 static DECLCALLBACK(int) VBoxServiceVMStatsOption(const char **ppszShort, int argc, char **argv, int *pi) 96 { 97 NOREF(ppszShort); 98 NOREF(argc); 99 NOREF(argv); 100 NOREF(pi); 101 102 return -1; 103 } 85 104 86 105 … … 662 681 663 682 683 /** @copydoc VBOXSERVICE::pfnTerm */ 684 static DECLCALLBACK(void) VBoxServiceVMStatsTerm(void) 685 { 686 VBoxServiceVerbose(3, "VBoxServiceVMStatsTerm\n"); 687 return; 688 } 689 690 664 691 /** @copydoc VBOXSERVICE::pfnStop */ 665 692 static DECLCALLBACK(void) VBoxServiceVMStatsStop(void) … … 683 710 NULL, 684 711 /* methods */ 685 /* pfnPreInit */ 686 NULL, 687 /* pfnOption */ 688 NULL, 712 VBoxServiceVMStatsPreInit, 713 VBoxServiceVMStatsOption, 689 714 VBoxServiceVMStatsInit, 690 715 VBoxServiceVMStatsWorker, 691 716 VBoxServiceVMStatsStop, 692 /* pfnTerm */ 693 NULL 717 VBoxServiceVMStatsTerm 694 718 }; 695 719 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r51523 r51564 155 155 156 156 157 /** @copydoc VBOXSERVICE::pfnPreInit */ 158 static DECLCALLBACK(int) VBoxServiceVMInfoPreInit(void) 159 { 160 return VINF_SUCCESS; 161 } 162 163 157 164 /** @copydoc VBOXSERVICE::pfnOption */ 158 165 static DECLCALLBACK(int) VBoxServiceVMInfoOption(const char **ppszShort, int argc, char **argv, int *pi) … … 1591 1598 , 1592 1599 /* methods */ 1593 /* pfnPreInit */ 1594 NULL, 1600 VBoxServiceVMInfoPreInit, 1595 1601 VBoxServiceVMInfoOption, 1596 1602 VBoxServiceVMInfoInit,
Note:
See TracChangeset
for help on using the changeset viewer.