Changeset 6029 in vbox for trunk/src/VBox
- Timestamp:
- Dec 9, 2007 9:51:13 PM (17 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk
r5999 r6029 1 1 # $Id$ 2 2 ## @file 3 # Makefile for the OS/2Guest Addition Services.3 # Makefile for the Cross Platform Guest Addition Services. 4 4 # 5 5 … … 16 16 # 17 17 18 DEPTH = ../../../../.. 19 include $(PATH_KBUILD)/header.kmk 18 DEPTH ?= ../../../../.. 19 SUB_DEPTH = ../.. 20 include $(PATH_KBUILD)/subheader.kmk 20 21 21 22 # … … 23 24 # 24 25 PROGRAMS += VBoxService 25 VBoxService_TEMPLATE = VBOX OS2GUESTR326 VBoxService_TEMPLATE = VBOXGUESTR3EXE 26 27 VBoxService_DEFS = VBOXSERVICE_TIMESYNC 27 28 VBoxService_DEFS.os2 = VBOX_HGCM VBOXSERVICE_CLIPBOARD 28 29 VBoxService_SOURCES = \ 29 30 VBoxService.cpp \ 30 VBoxServiceTimeSync.cpp 31 VBoxServiceTimeSync.cpp 31 32 VBoxService_SOURCES.os2 = \ 32 33 VBoxService-os2.cpp \ 33 34 VBoxService-os2.def \ 34 VBoxServiceClipboard-os2.cpp 35 #VBoxService_LDFLAGS = -t -v 35 VBoxServiceClipboard-os2.cpp 36 36 VBoxService_LIBS = \ 37 $(VBOX_LIB_VBGL_ OS2_R3) \38 $(VBOX_LIB_IPRT_ OS2_GUEST_R3)37 $(VBOX_LIB_VBGL_R3) \ 38 $(VBOX_LIB_IPRT_GUEST_R3) 39 39 40 include $(PATH_KBUILD)/ footer.kmk40 include $(PATH_KBUILD)/subfooter.kmk 41 41 -
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r5999 r6029 21 21 * Header Files * 22 22 *******************************************************************************/ 23 #include <unistd.h> 23 #ifndef _MSC_VER 24 # include <unistd.h> 25 #endif 24 26 #include <errno.h> 25 27 … … 49 51 * The details of the services that has been compiled in. 50 52 */ 51 static struct 53 static struct 52 54 { 53 55 /** Pointer to the service descriptor. */ … … 63 65 /** Whether the service is enabled or not. */ 64 66 bool fEnabled; 65 } g_aServices[] = 67 } g_aServices[] = 66 68 { 67 69 #ifdef VBOXSERVICE_CONTROL 68 70 { &g_Control, NIL_RTTHREAD, false, false, false, true }, 69 #endif 71 #endif 70 72 #ifdef VBOXSERVICE_TIMESYNC 71 73 { &g_TimeSync, NIL_RTTHREAD, false, false, false, true }, 72 #endif 74 #endif 73 75 #ifdef VBOXSERVICE_CLIPBOARD 74 76 { &g_Clipboard, NIL_RTTHREAD, false, false, false, true }, 75 #endif 77 #endif 76 78 }; 77 79 … … 79 81 /** 80 82 * Displays the program usage message. 81 * 83 * 82 84 * @returns 1. 83 85 */ … … 109 111 /** 110 112 * Displays a syntax error message. 111 * 113 * 112 114 * @returns 1 113 115 * @param pszFormat The message text. … … 129 131 /** 130 132 * Displays an error message. 131 * 133 * 132 134 * @returns 1 133 135 * @param pszFormat The message text. … … 149 151 /** 150 152 * Displays a verbose message. 151 * 153 * 152 154 * @returns 1 153 155 * @param pszFormat The message text. … … 195 197 return VBoxServiceSyntax("Failed to convert interval '%s' to a number.\n", psz); 196 198 if (*pu32 < u32Min || *pu32 > u32Max) 197 return VBoxServiceSyntax("The timesync interval of %RU32 secconds is out of range [%RU32..%RU32].\n", 199 return VBoxServiceSyntax("The timesync interval of %RU32 secconds is out of range [%RU32..%RU32].\n", 198 200 *pu32, u32Min, u32Max); 199 201 return 0; … … 203 205 /** 204 206 * The service thread. 205 * 207 * 206 208 * @returns Whatever the worker function returns. 207 209 * @param ThreadSelf My thread handle. … … 302 304 { 303 305 case 'i': 304 rc = VBoxServiceArgUInt32(argc, argv, psz + 1, &i, 306 rc = VBoxServiceArgUInt32(argc, argv, psz + 1, &i, 305 307 &g_DefaultInterval, 1, (UINT32_MAX / 1000) - 1); 306 308 if (rc) … … 391 393 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++) 392 394 { 393 if ( !g_aServices[j].fEnabled 395 if ( !g_aServices[j].fEnabled 394 396 || j == iMain) 395 397 continue; 396 398 397 rc = RTThreadCreate(&g_aServices[j].Thread, VBoxServiceThread, (void *)(uintptr_t)j, 0, 399 rc = RTThreadCreate(&g_aServices[j].Thread, VBoxServiceThread, (void *)(uintptr_t)j, 0, 398 400 RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, g_aServices[j].pDesc->pszName); 399 401 if (RT_FAILURE(rc)) -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r5999 r6029 93 93 extern int VBoxServiceArgUInt32(int argc, char **argv, const char *psz, int *pi, uint32_t *pu32, uint32_t u32Min, uint32_t u32Max); 94 94 95 #if def __OS2__95 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 96 96 extern int daemon(int, int); 97 97 #endif -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp
r5999 r6029 80 80 * Header Files * 81 81 *******************************************************************************/ 82 #include <unistd.h> 83 #include <errno.h> 84 #include <time.h> 85 #include <sys/time.h> 82 #ifdef RT_OS_WINDOWS 83 #else 84 # include <unistd.h> 85 # include <errno.h> 86 # include <time.h> 87 # include <sys/time.h> 88 #endif 86 89 87 90 #include <iprt/thread.h> … … 229 232 * *NIX systems have it. Fall back on settimeofday. 230 233 */ 234 #ifdef RT_OS_WINDOWS 235 /* just make sure it compiles for now, but later: 236 SetSystemTimeAdjustment and fall back on SetSystemTime. 237 */ 238 AssertFatalFailed(); 239 #else 231 240 struct timeval tv; 232 # if !defined(RT_OS_OS2) /* PORTME */241 # if !defined(RT_OS_OS2) /* PORTME */ 233 242 RTTimeSpecGetTimeval(Drift, &tv); 234 243 if (adjtime(&tv, NULL) == 0) … … 239 248 } 240 249 else 241 # endif250 # endif 242 251 { 243 252 errno = 0; … … 251 260 VBoxServiceVerbose(1, "settimeofday to %s\n", 252 261 RTTimeToString(RTTimeExplode(&Time, &Tmp), sz, sizeof(sz))); 253 # ifdef DEBUG262 # ifdef DEBUG 254 263 if (g_cVerbosity >= 3) 255 264 VBoxServiceVerbose(2, " new time %s\n", 256 265 RTTimeToString(RTTimeExplode(&Time, RTTimeNow(&Tmp)), sz, sizeof(sz))); 257 # endif266 # endif 258 267 cErrors = 0; 259 268 } … … 264 273 VBoxServiceError("gettimeofday failed; errno=%d: %s\n", errno, strerror(errno)); 265 274 } 275 #endif /* !RT_OS_WINDOWS */ 266 276 } 267 277 break;
Note:
See TracChangeset
for help on using the changeset viewer.