VirtualBox

Ignore:
Timestamp:
Jul 19, 2007 7:01:52 PM (17 years ago)
Author:
vboxsync
Message:

Double underscore cleanup.

Location:
trunk/src/VBox/Additions/os2/VBoxService
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/os2/VBoxService/VBoxService-os2.cpp

    r3655 r3725  
    2323*   Global Variables                                                           *
    2424*******************************************************************************/
    25 #ifdef __OS2__
     25#ifdef RT_OS_OS2
    2626# define INCL_BASE
    2727# define INCL_ERRORS
    2828# include <os2.h>
    29 #endif 
     29#endif
    3030#include <errno.h>
    3131
  • trunk/src/VBox/Additions/os2/VBoxService/VBoxServiceInternal.h

    r3655 r3725  
     1/* $Id$ */
    12/** @file
    23 * VBoxService - Guest Additions Services.
     
    1920 */
    2021
    21 #ifndef ___VBoxServiceInternal_h___
    22 #define ___VBoxServiceInternal_h___
     22#ifndef ___VBoxServiceInternal_h
     23#define ___VBoxServiceInternal_h
    2324
    2425/**
    2526 * A service descriptor.
    2627 */
    27 typedef struct 
     28typedef struct
    2829{
    2930    /** The short service name. */
     
    4142     */
    4243    DECLCALLBACKMEMBER(int, pfnPreInit)(void);
    43    
     44
    4445    /**
    4546     * Tries to parse the given command line option.
    4647     *
    4748     * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
    48      * @param   ppszShort   If not NULL it points to the short option iterator. a short argument. 
     49     * @param   ppszShort   If not NULL it points to the short option iterator. a short argument.
    4950     *                      If NULL examine argv[*pi].
    5051     * @param   argc        The argument count.
     
    5354     */
    5455    DECLCALLBACKMEMBER(int, pfnOption)(const char **ppszShort, int argc, char **argv, int *pi);
    55    
     56
    5657    /**
    5758     * Called before parsing arguments.
     
    6061    DECLCALLBACKMEMBER(int, pfnInit)(void);
    6162
    62     /** Called from the worker thread. 
    63      * 
     63    /** Called from the worker thread.
     64     *
    6465     * @returns VBox status code.
    6566     * @retval  VINF_SUCCESS if exitting because *pfTerminate was set.
    66      * @param   pfTerminate     Pointer to a per service termination flag to check 
     67     * @param   pfTerminate     Pointer to a per service termination flag to check
    6768     *                          before and after blocking.
    6869     */
    6970    DECLCALLBACKMEMBER(int, pfnWorker)(bool volatile *pfTerminate);
    70    
     71
    7172    /**
    7273     * Stop an service.
     
    8384/** Pointer to a const VBOXSERVICE. */
    8485typedef VBOXSERVICE const *PCVBOXSERVICE;
    85          
    86          
     86
     87
    8788__BEGIN_DECLS
    8889
     
    9899#ifdef __OS2__
    99100extern int daemon(int, int);
    100 #endif 
     101#endif
    101102
    102103extern VBOXSERVICE g_TimeSync;
  • trunk/src/VBox/Additions/os2/VBoxService/VBoxServiceTimeSync.cpp

    r3655 r3725  
    2323/** @page pg_vboxservice_timesync       The Time Sync Service
    2424 *
    25  * The time sync service plays along with the Time Manager (TM) in the VMM 
    26  * to keep the guest time accurate using the host machine as reference. 
     25 * The time sync service plays along with the Time Manager (TM) in the VMM
     26 * to keep the guest time accurate using the host machine as reference.
    2727 * TM will try its best to make sure all timer ticks gets delivered so that
    2828 * there isn't normally any need to adjust the guest time.
    29  * 
     29 *
    3030 * There are three normal (= acceptable) cases:
    3131 *      -# When the service starts up. This is because ticks and such might
    3232 *         be lost during VM and OS startup. (Need to figure out exactly why!)
    33  *      -# When the TM is unable to deliver all the ticks and swallows a 
     33 *      -# When the TM is unable to deliver all the ticks and swallows a
    3434 *         backlog of ticks. The threshold for this is configurable with
    3535 *         a default of 60 seconds.
    36  *      -# The time is adjusted on the host. This can be caused manually by 
     36 *      -# The time is adjusted on the host. This can be caused manually by
    3737 *         the user or by some time sync daemon (NTP, LAN server, etc.).
    38  * 
    39  * There are a number of very odd case where adjusting is needed. Here 
     38 *
     39 * There are a number of very odd case where adjusting is needed. Here
    4040 * are some of them:
    4141 *      -# Timer device emulation inaccurancies (like rounding).
     
    4343 *      -# The Guest and/or Host OS doesn't perform proper time keeping. This
    4444 *         come about as a result of OS and/or hardware issues.
    45  * 
    46  * The TM is our source for the host time and will make adjustments for 
    47  * current timer delivery lag. The simplistic approach taken by TM is to 
     45 *
     46 * The TM is our source for the host time and will make adjustments for
     47 * current timer delivery lag. The simplistic approach taken by TM is to
    4848 * adjust the host time by the current guest timer delivery lag, meaning that
    4949 * if the guest is behind 1 second with PIT/RTC/++ ticks this should be reflected
    5050 * in the guest wall time as well.
    51  * 
     51 *
    5252 * Now, there is any amount of trouble we can cause by changing the time.
    53  * Most applications probably uses the wall time when they need to measure 
     53 * Most applications probably uses the wall time when they need to measure
    5454 * things. A walltime that is being juggled about every so often, even if just
    5555 * a little bit, could occationally upset these measurements by for instance
    5656 * yielding negative results.
    57  * 
    58  * This bottom line here is that the time sync service isn't really supposed 
     57 *
     58 * This bottom line here is that the time sync service isn't really supposed
    5959 * to do anything and will try avoid having to do anything when possible.
    60  * 
     60 *
    6161 * The implementation uses the latency it takes to query host time as the
    62  * absolute maximum precision to avoid messing up under timer tick catchup 
     62 * absolute maximum precision to avoid messing up under timer tick catchup
    6363 * and/or heavy host/guest load. (Rational is that a *lot* of stuff may happen
    6464 * on our way back from ring-3 and TM/VMMDev since we're taking the route
    6565 * thru the inner EM loop with it's force action processing.)
    66  * 
    67  * But this latency has to be measured from our perspective, which means it 
    68  * could just as easily come out as 0. (OS/2 and Windows guest only updates 
     66 *
     67 * But this latency has to be measured from our perspective, which means it
     68 * could just as easily come out as 0. (OS/2 and Windows guest only updates
    6969 * the current time when the timer ticks for instance.) The good thing is
    70  * that this isn't really a problem since we won't ever do anything unless 
     70 * that this isn't really a problem since we won't ever do anything unless
    7171 * the drift is noticable.
    72  * 
    73  * It now boils down to these three (configuration) factors: 
     72 *
     73 * It now boils down to these three (configuration) factors:
    7474 *  -# g_TimesyncMinAdjust - The minimum drift we will ever bother with.
    7575 *  -# g_TimesyncLatencyFactor - The factor we multiply the latency by to
    7676 *     calculate the dynamic minimum adjust factor.
    77  *  -# g_TimesyncMaxLatency - When to start discarding the data as utterly 
     77 *  -# g_TimesyncMaxLatency - When to start discarding the data as utterly
    7878 *     useless and take a rest (someone is too busy to give us good data).
    7979 */
     
    8484*   Header Files                                                               *
    8585*******************************************************************************/
    86 #include <unistd.h> 
     86#include <unistd.h>
    8787#include <errno.h>
    8888#include <time.h>
     
    105105/**
    106106 * @see pg_vboxservice_timesync
    107  * 
    108  * @remark  OS/2: There is either a 1 second resolution on the DosSetDateTime 
     107 *
     108 * @remark  OS/2: There is either a 1 second resolution on the DosSetDateTime
    109109 *                API or a but in the settimeofday implementation. Thus, don't
    110110 *                bother unless there is at least a 1 second drift.
    111111 */
    112 #ifdef __OS2__
     112#ifdef RT_OS_OS2
    113113static uint32_t g_TimeSyncMinAdjust = 1000;
    114114#else
    115115static uint32_t g_TimeSyncMinAdjust = 100;
    116 #endif 
     116#endif
    117117/** @see pg_vboxservice_timesync */
    118118static uint32_t g_TimeSyncLatencyFactor = 8;
     
    138138        /* no short options */;
    139139    else if (!strcmp(argv[*pi], "--timesync-interval"))
    140         rc = VBoxServiceArgUInt32(argc, argv, "", pi, 
     140        rc = VBoxServiceArgUInt32(argc, argv, "", pi,
    141141                                  &g_TimeSyncInterval, 1, UINT32_MAX - 1);
    142142    else if (!strcmp(argv[*pi], "--timesync-min-adjust"))
    143         rc = VBoxServiceArgUInt32(argc, argv, "", pi, 
     143        rc = VBoxServiceArgUInt32(argc, argv, "", pi,
    144144                                  &g_TimeSyncMinAdjust, 0, 3600000);
    145145    else if (!strcmp(argv[*pi], "--timesync-latency-factor"))
    146         rc = VBoxServiceArgUInt32(argc, argv, "", pi, 
     146        rc = VBoxServiceArgUInt32(argc, argv, "", pi,
    147147                                  &g_TimeSyncLatencyFactor, 1, 1024);
    148148    else if (!strcmp(argv[*pi], "--timesync-max-latency"))
    149         rc = VBoxServiceArgUInt32(argc, argv, "", pi, 
     149        rc = VBoxServiceArgUInt32(argc, argv, "", pi,
    150150                                  &g_TimeSyncMaxLatency, 1, 3600000);
    151151    return rc;
     
    156156static DECLCALLBACK(int) VBoxServiceTimeSyncInit(void)
    157157{
    158     /* 
     158    /*
    159159     * If not specified, find the right interval default.
    160160     * Then create the event sem to block on.
     
    220220                if (g_cVerbosity >= 3)
    221221                {
    222                     VBoxServiceVerbose(3, "Host:    %s    (MinAdjust: %RU32 ms)\n", 
     222                    VBoxServiceVerbose(3, "Host:    %s    (MinAdjust: %RU32 ms)\n",
    223223                                       RTTimeToString(RTTimeExplode(&Time, &HostNow), sz, sizeof(sz)), MinAdjust);
    224                     VBoxServiceVerbose(3, "Guest: - %s => %RDtimespec drift\n", 
     224                    VBoxServiceVerbose(3, "Guest: - %s => %RDtimespec drift\n",
    225225                                       RTTimeToString(RTTimeExplode(&Time, &GuestNow), sz, sizeof(sz)),
    226226                                       &Drift);
     
    230230                    /*
    231231                     * The drift is to big, we have to make adjustments. :-/
    232                      * If we've got adjtime around, try that first - most 
     232                     * If we've got adjtime around, try that first - most
    233233                     * *NIX systems have it. Fall back on settimeofday.
    234234                     */
    235235                    struct timeval tv;
    236 #if !defined(__OS2__) /* PORTME */
     236#if !defined(RT_OS_OS2) /* PORTME */
    237237                    RTTimeSpecGetTimeval(Drift, &tv);
    238238                    if (adjtime(&tv, NULL) == 0)
     
    243243                    }
    244244                    else
    245 #endif             
     245#endif
    246246                    {
    247247                        errno = 0;
     
    253253                            {
    254254                                if (g_cVerbosity >= 1)
    255                                     VBoxServiceVerbose(1, "settimeofday to %s\n", 
     255                                    VBoxServiceVerbose(1, "settimeofday to %s\n",
    256256                                                       RTTimeToString(RTTimeExplode(&Time, &Tmp), sz, sizeof(sz)));
    257257#ifdef DEBUG
    258258                                if (g_cVerbosity >= 3)
    259                                     VBoxServiceVerbose(2, "       new time %s\n", 
     259                                    VBoxServiceVerbose(2, "       new time %s\n",
    260260                                                       RTTimeToString(RTTimeExplode(&Time, RTTimeNow(&Tmp)), sz, sizeof(sz)));
    261261#endif
     
    318318 * The 'timesync' service description.
    319319 */
    320 VBOXSERVICE g_TimeSync = 
     320VBOXSERVICE g_TimeSync =
    321321{
    322322    /* pszName. */
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