VirtualBox

Changeset 6029 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 9, 2007 9:51:13 PM (17 years ago)
Author:
vboxsync
Message:

Moved os2/VBoxService into common space.

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  
    11# $Id$
    22## @file
    3 # Makefile for the OS/2 Guest Addition Services.
     3# Makefile for the Cross Platform Guest Addition Services.
    44#
    55
     
    1616#
    1717
    18 DEPTH = ../../../../..
    19 include $(PATH_KBUILD)/header.kmk
     18DEPTH ?= ../../../../..
     19SUB_DEPTH = ../..
     20include $(PATH_KBUILD)/subheader.kmk
    2021
    2122#
     
    2324#
    2425PROGRAMS += VBoxService
    25 VBoxService_TEMPLATE      = VBOXOS2GUESTR3
     26VBoxService_TEMPLATE      = VBOXGUESTR3EXE
    2627VBoxService_DEFS          = VBOXSERVICE_TIMESYNC
    2728VBoxService_DEFS.os2      = VBOX_HGCM VBOXSERVICE_CLIPBOARD
    2829VBoxService_SOURCES       = \
    2930        VBoxService.cpp \
    30         VBoxServiceTimeSync.cpp 
     31        VBoxServiceTimeSync.cpp
    3132VBoxService_SOURCES.os2   = \
    3233        VBoxService-os2.cpp \
    3334        VBoxService-os2.def \
    34         VBoxServiceClipboard-os2.cpp
    35 #VBoxService_LDFLAGS       = -t -v
     35        VBoxServiceClipboard-os2.cpp
    3636VBoxService_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)
    3939
    40 include $(PATH_KBUILD)/footer.kmk
     40include $(PATH_KBUILD)/subfooter.kmk
    4141
  • trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp

    r5999 r6029  
    2121*   Header Files                                                               *
    2222*******************************************************************************/
    23 #include <unistd.h>
     23#ifndef _MSC_VER
     24# include <unistd.h>
     25#endif
    2426#include <errno.h>
    2527
     
    4951 * The details of the services that has been compiled in.
    5052 */
    51 static struct 
     53static struct
    5254{
    5355    /** Pointer to the service descriptor. */
     
    6365    /** Whether the service is enabled or not. */
    6466    bool            fEnabled;
    65 } g_aServices[] = 
     67} g_aServices[] =
    6668{
    6769#ifdef VBOXSERVICE_CONTROL
    6870    { &g_Control,   NIL_RTTHREAD, false, false, false, true },
    69 #endif 
     71#endif
    7072#ifdef VBOXSERVICE_TIMESYNC
    7173    { &g_TimeSync,  NIL_RTTHREAD, false, false, false, true },
    72 #endif 
     74#endif
    7375#ifdef VBOXSERVICE_CLIPBOARD
    7476    { &g_Clipboard, NIL_RTTHREAD, false, false, false, true },
    75 #endif 
     77#endif
    7678};
    7779
     
    7981/**
    8082 * Displays the program usage message.
    81  * 
     83 *
    8284 * @returns 1.
    8385 */
     
    109111/**
    110112 * Displays a syntax error message.
    111  * 
     113 *
    112114 * @returns 1
    113115 * @param   pszFormat   The message text.
     
    129131/**
    130132 * Displays an error message.
    131  * 
     133 *
    132134 * @returns 1
    133135 * @param   pszFormat   The message text.
     
    149151/**
    150152 * Displays a verbose message.
    151  * 
     153 *
    152154 * @returns 1
    153155 * @param   pszFormat   The message text.
     
    195197        return VBoxServiceSyntax("Failed to convert interval '%s' to a number.\n", psz);
    196198    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",
    198200                                 *pu32, u32Min, u32Max);
    199201    return 0;
     
    203205/**
    204206 * The service thread.
    205  * 
     207 *
    206208 * @returns Whatever the worker function returns.
    207209 * @param   ThreadSelf      My thread handle.
     
    302304            {
    303305                case 'i':
    304                     rc = VBoxServiceArgUInt32(argc, argv, psz + 1, &i, 
     306                    rc = VBoxServiceArgUInt32(argc, argv, psz + 1, &i,
    305307                                              &g_DefaultInterval, 1, (UINT32_MAX / 1000) - 1);
    306308                    if (rc)
     
    391393    for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++)
    392394    {
    393         if (    !g_aServices[j].fEnabled 
     395        if (    !g_aServices[j].fEnabled
    394396            ||  j == iMain)
    395397            continue;
    396398
    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,
    398400                            RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, g_aServices[j].pDesc->pszName);
    399401        if (RT_FAILURE(rc))
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h

    r5999 r6029  
    9393extern int VBoxServiceArgUInt32(int argc, char **argv, const char *psz, int *pi, uint32_t *pu32, uint32_t u32Min, uint32_t u32Max);
    9494
    95 #ifdef __OS2__
     95#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
    9696extern int daemon(int, int);
    9797#endif
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp

    r5999 r6029  
    8080*   Header Files                                                               *
    8181*******************************************************************************/
    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
    8689
    8790#include <iprt/thread.h>
     
    229232                     * *NIX systems have it. Fall back on settimeofday.
    230233                     */
     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
    231240                    struct timeval tv;
    232 #if !defined(RT_OS_OS2) /* PORTME */
     241# if !defined(RT_OS_OS2) /* PORTME */
    233242                    RTTimeSpecGetTimeval(Drift, &tv);
    234243                    if (adjtime(&tv, NULL) == 0)
     
    239248                    }
    240249                    else
    241 #endif
     250# endif
    242251                    {
    243252                        errno = 0;
     
    251260                                    VBoxServiceVerbose(1, "settimeofday to %s\n",
    252261                                                       RTTimeToString(RTTimeExplode(&Time, &Tmp), sz, sizeof(sz)));
    253 #ifdef DEBUG
     262# ifdef DEBUG
    254263                                if (g_cVerbosity >= 3)
    255264                                    VBoxServiceVerbose(2, "       new time %s\n",
    256265                                                       RTTimeToString(RTTimeExplode(&Time, RTTimeNow(&Tmp)), sz, sizeof(sz)));
    257 #endif
     266# endif
    258267                                cErrors = 0;
    259268                            }
     
    264273                            VBoxServiceError("gettimeofday failed; errno=%d: %s\n", errno, strerror(errno));
    265274                    }
     275#endif /* !RT_OS_WINDOWS */
    266276                }
    267277                break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette