VirtualBox

Changeset 3480 in vbox


Ignore:
Timestamp:
Jul 5, 2007 3:48:41 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
22692
Message:

Main: Use named mutexes for watching client processes on OS/2.

Location:
trunk/src/VBox/Main
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r3424 r3480  
    73837383#if defined(__WIN__)
    73847384    mIPCSem = NULL;
     7385#elif defined(__OS2__)
     7386    mIPCSem = NULLHANDLE;
    73857387#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    73867388    mIPCSem = -1;
     7389#else
     7390# error "Port me!"
    73877391#endif
    73887392
     
    74207424            mIPCSemName[i] = '/';
    74217425    mIPCSem = ::CreateMutex (NULL, FALSE, mIPCSemName);
    7422     ComAssertMsgRet (mIPCSem, ("Cannot create IPC mutex, err=0x%08X", ::GetLastError()),
     7426    ComAssertMsgRet (mIPCSem,
     7427                     ("Cannot create IPC mutex '%ls', err=%d\n",
     7428                      mIPCSemName.raw(), ::GetLastError()),
     7429                     E_FAIL);
     7430#elif defined(__OS2__)
     7431    Utf8Str ipcSem = Utf8StrFmt ("\\SEM32\\VBOX\\VM\\{%Vuuid}",
     7432                                 aMachine->mData->mUuid.raw());
     7433    mIPCSemName = ipcSem;
     7434    APIRET arc = ::DosCreateMutexSem ((PSZ) ipcSem.raw(), &mIPCSem, 0, FALSE);
     7435    ComAssertMsgRet (arc == NO_ERROR,
     7436                     ("Cannot create IPC mutex '%s', arc=%ld\n",
     7437                      ipcSem.raw(), arc),
    74237438                     E_FAIL);
    74247439#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    74257440    Utf8Str configFile = aMachine->mData->mConfigFileFull;
    7426     char *pszConfigFile = NULL;
    7427     RTStrUtf8ToCurrentCP (&pszConfigFile, configFile);
    7428     key_t key = ::ftok (pszConfigFile, 0);
    7429     RTStrFree (pszConfigFile);
     7441    char *configFileCP = NULL;
     7442    RTStrUtf8ToCurrentCP (&configFileCP, configFile);
     7443    key_t key = ::ftok (configFileCP, 0);
     7444    RTStrFree (configFileCP);
    74307445    mIPCSem = ::semget (key, 1, S_IRWXU | S_IRWXG | S_IRWXO | IPC_CREAT);
    74317446    ComAssertMsgRet (mIPCSem >= 0, ("Cannot create IPC semaphore, errno=%d", errno),
     
    74357450    ComAssertMsgRet (rv == 0, ("Cannot init IPC semaphore, errno=%d", errno),
    74367451                     E_FAIL);
     7452#else
     7453# error "Port me!"
    74377454#endif
    74387455
     
    75267543            ::CloseHandle (mIPCSem);
    75277544        mIPCSem = NULL;
     7545#elif defined(__OS2__)
     7546        if (mIPCSem != NULLHANDLE)
     7547            ::DosCloseMutexSem (mIPCSem);
     7548        mIPCSem = NULLHANDLE;
    75287549#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    75297550        if (mIPCSem >= 0)
    75307551            ::semctl (mIPCSem, 0, IPC_RMID);
    75317552        mIPCSem = -1;
     7553#else
     7554# error "Port me!"
    75327555#endif
    75337556        uninitDataAndChildObjects();
     
    76687691        ::CloseHandle (mIPCSem);
    76697692    mIPCSem = NULL;
     7693#elif defined(__OS2__)
     7694    if (mIPCSem != NULLHANDLE)
     7695        ::DosCloseMutexSem (mIPCSem);
     7696    mIPCSem = NULLHANDLE;
    76707697#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    76717698    if (mIPCSem >= 0)
    76727699        ::semctl (mIPCSem, 0, IPC_RMID);
    76737700    mIPCSem = -1;
     7701#else
     7702# error "Port me!"
    76747703#endif
    76757704
     
    77227751    AutoReaderLock alock (this);
    77237752
    7724 #if defined(__WIN__)
     7753#if defined(__WIN__) || defined(__OS2__)
    77257754    mIPCSemName.cloneTo (id);
    77267755    return S_OK;
     
    77297758    return S_OK;
    77307759#else
    7731     return S_FAIL;
     7760# error "Port me!"
    77327761#endif
    77337762}
     
    84318460 *  process death.
    84328461 *
    8433  *  @note On Win32, this method is called only when we've got the semaphore
    8434  *  (i.e. it has been signaled when we were waiting for it).
    8435  *
    8436  *  On Win32, this method always returns true.
    8437  *
    8438  *  On Linux, the method returns true if the client process has terminated
    8439  *  abnormally (and/or the session has been uninitialized) and false if it is
    8440  *  still alive.
     8462 *  @note On Win32 and on OS/2, this method is called only when we've got the
     8463 *  mutex (i.e. the client has either died or terminated normally). This
     8464 *  method always returns true.
     8465 *
     8466 *  @note On Linux, the method returns true if the client process has
     8467 *  terminated abnormally (and/or the session has been uninitialized) and
     8468 *  false if it is still alive.
    84418469 *
    84428470 *  @note Locks this object for writing.
     
    84468474    Uninit::Reason reason;
    84478475    bool doUninit = false;
    8448     bool rc = false;
     8476    bool ret = false;
    84498477
    84508478    /*
     
    84888516        doUninit = true;
    84898517
    8490         rc = true;
     8518        ret = true;
     8519
     8520#elif defined(__OS2__)
     8521
     8522        AssertMsg (mIPCSem, ("semaphore must be created"));
     8523
     8524        /* release the IPC mutex */
     8525        ::DosReleaseMutexSem (mIPCSem);
     8526
     8527        doUninit = true;
     8528
     8529        ret = true;
    84918530
    84928531#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     
    85018540        }
    85028541
    8503         rc = val > 0;
    8504 
     8542        ret = val > 0;
     8543
     8544#else
     8545# error "Port me!"
    85058546#endif
    85068547
     
    85108551        uninit (reason);
    85118552
    8512     return rc;
     8553    return ret;
    85138554}
    85148555
  • trunk/src/VBox/Main/Makefile.kmk

    r3278 r3480  
    3737 endif
    3838 DLLS           += VBoxSVCM
    39  DEFS           += VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
     39 ifneq ($(BUILD_TARGET),os2)
     40  DEFS          += VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
     41 endif
    4042 DEFS           += VBOX_WITH_UNIXY_TAP_NETWORKING
    4143endif
  • trunk/src/VBox/Main/SessionImpl.cpp

    r3001 r3480  
    4040#include <iprt/process.h>
    4141
    42 #if defined(__WIN__)
     42#if defined(__WIN__) || defined (__OS2__)
    4343/** VM IPC mutex holder thread */
    4444static DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser);
     
    9494    mIPCSem = NULL;
    9595    mIPCThreadSem = NULL;
     96#elif defined(__OS2__)
     97    mIPCThread = NIL_RTTHREAD;
     98    mIPCThreadSem = NIL_RTSEMEVENT;
    9699#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    97100    mIPCSem = -1;
     101#else
     102# error "Port me!"
    98103#endif
    99104
     
    645650#if defined(__WIN__)
    646651        Assert (!mIPCSem && !mIPCThreadSem);
     652#elif defined(__OS2__)
     653        Assert (mIPCThread == NIL_RTTHREAD &&
     654                mIPCThreadSem == NIL_RTSEMEVENT);
    647655#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    648656        Assert (mIPCSem == -1);
     657#else
     658# error "Port me!"
    649659#endif
    650660        LogFlowThisFuncLeave();
     
    741751    Bstr ipcId;
    742752    rc = mControl->GetIPCId (ipcId.asOutParam());
    743     AssertComRCReturn (rc, rc);
    744 
    745     LogFlowThisFunc (("ipcId: {%ls}\n", ipcId.raw()));
     753    AssertComRCReturnRC (rc);
     754
     755    LogFlowThisFunc (("ipcId='%ls'\n", ipcId.raw()));
    746756
    747757#if defined(__WIN__)
     
    764774    data [2] = 0; /* will get an output from the thread */
    765775
    766     /* create the thread to hold the IPC mutex until signalled to release it */
     776    /* create a thread to hold the IPC mutex until signalled to release it */
    767777    RTTHREAD tid;
    768778    int vrc = RTThreadCreate (&tid, IPCMutexHolderThread, (void *) data,
     
    772782    /* wait until thread init is completed */
    773783    DWORD wrc = ::WaitForSingleObject (mIPCThreadSem, INFINITE);
    774     AssertMsg (wrc == WAIT_OBJECT_0, ("Wait failed, err=%d", ::GetLastError()));
     784    AssertMsg (wrc == WAIT_OBJECT_0, ("Wait failed, err=%d\n", ::GetLastError()));
    775785    Assert (data [2]);
    776786
     
    787797        rc = E_FAIL;
    788798    }
     799
     800#elif defined(__OS2__)
     801
     802    /* We use XPCOM where any message (including close()) can arrive on any
     803     * worker thread (which will not necessarily match this thread that opens
     804     * the mutex). Therefore, we need a separate thread to hold the IPC mutex
     805     * and then release it in close(). */
     806
     807    int vrc = RTSemEventCreate (&mIPCThreadSem);
     808    AssertRCReturn (vrc, E_FAIL);
     809
     810    void *data [3];
     811    data [0] = (void *) ipcId.raw();
     812    data [1] = (void *) mIPCThreadSem;
     813    data [2] = (void *) false; /* will get the thread result here */
     814
     815    /* create a thread to hold the IPC mutex until signalled to release it */
     816    vrc = RTThreadCreate (&mIPCThread, IPCMutexHolderThread, (void *) data,
     817                          0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder");
     818    AssertRCReturn (vrc, E_FAIL);
     819
     820    /* wait until thread init is completed */
     821    vrc = RTThreadUserWait (mIPCThread, RT_INDEFINITE_WAIT);
     822    AssertReturn (VBOX_SUCCESS (vrc) || vrc == VERR_INTERRUPTED, E_FAIL);
     823
     824    /* the thread must succeed */
     825    AssertReturn ((bool) data [2], E_FAIL);
    789826
    790827#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     
    808845                    E_FAIL);
    809846
     847#else
     848# error "Port me!"
    810849#endif
    811850
     
    818857    /* release the IPC semaphore */
    819858#if defined(__WIN__)
     859
    820860    if (mIPCSem && mIPCThreadSem)
    821861    {
    822862        /*
    823          *  say the thread holding the IPC mutex to release it;
     863         *  tell the thread holding the IPC mutex to release it;
    824864         *  it will close mIPCSem handle
    825865         */
     
    829869        ::CloseHandle (mIPCThreadSem);
    830870    }
     871
     872#elif defined(__OS2__)
     873
     874    if (mIPCThread != NIL_RTTHREAD)
     875    {
     876        Assert (mIPCThreadSem != NIL_RTSEMEVENT);
     877
     878        /* tell the thread holding the IPC mutex to release it */
     879        int vrc = RTSemEventSignal (mIPCThreadSem);
     880        AssertRC (vrc == NO_ERROR);
     881
     882        /* wait for the thread to finish */
     883        vrc = RTThreadUserWait (mIPCThread, RT_INDEFINITE_WAIT);
     884        Assert (VBOX_SUCCESS (vrc) || vrc == VERR_INTERRUPTED);
     885
     886        mIPCThread = NIL_RTTHREAD;
     887    }
     888
     889    if (mIPCThreadSem != NIL_RTSEMEVENT)
     890    {
     891        RTSemEventDestroy (mIPCThreadSem);
     892        mIPCThreadSem = NIL_RTSEMEVENT;
     893    }
     894
    831895#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     896
    832897    if (mIPCSem >= 0)
    833898    {
     
    835900        ::semop (mIPCSem, &sop, 1);
    836901    }
     902
     903#else
     904# error "Port me!"
    837905#endif
    838906}
     
    851919
    852920    HANDLE ipcMutex = ::OpenMutex (MUTEX_ALL_ACCESS, FALSE, sessionId);
    853     AssertMsg (ipcMutex, ("cannot open IPC mutex, err=%08X\n", ::GetLastError()));
     921    AssertMsg (ipcMutex, ("cannot open IPC mutex, err=%d\n", ::GetLastError()));
    854922
    855923    if (ipcMutex)
     
    888956#endif
    889957
     958#if defined(__OS2__)
     959/** VM IPC mutex holder thread */
     960DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser)
     961{
     962    LogFlowFuncEnter();
     963
     964    Assert (pvUser);
     965    void **data = (void **) pvUser;
     966
     967    Utf8Str ipcId = (BSTR) data [0];
     968    RTSEMEVENT finishSem = (RTSEMEVENT) data [1];
     969
     970    LogFlowFunc (("ipcId='%s', finishSem=%p\n", ipcId.raw(), finishSem));
     971
     972    HMTX ipcMutex = NULLHANDLE;
     973    APIRET arc = ::DosOpenMutexSem ((PSZ) ipcId.raw(), &ipcMutex);
     974    AssertMsg (arc == NO_ERROR, ("cannot open IPC mutex, arc=%ld\n", arc));
     975
     976    if (arc == NO_ERROR)
     977    {
     978        /* grab the mutex */
     979        LogFlowFunc (("grabbing IPC mutex...\n"));
     980        arc = ::DosRequestMutexSem (ipcMutex, SEM_IMMEDIATE_RETURN);
     981        AssertMsg (arc == NO_ERROR, ("cannot grab IPC mutex, arc=%ld\n", arc));
     982        if (arc == NO_ERROR)
     983        {
     984            /* store the answer */
     985            data [2] = (void *) true;
     986            /* signal we're done */
     987            int vrc = RTThreadUserSignal (Thread);
     988            AssertRC (vrc);
     989
     990            /* wait until we're signaled to release the IPC mutex */
     991            LogFlowFunc (("waiting for termination signal..\n"));
     992            vrc = RTSemEventWait (finishSem, RT_INDEFINITE_WAIT);
     993            Assert (arc == ERROR_INTERRUPT || ERROR_TIMEOUT);
     994
     995            /* release the IPC mutex */
     996            LogFlowFunc (("releasing IPC mutex...\n"));
     997            arc = ::DosReleaseMutexSem (ipcMutex);
     998            AssertMsg (arc == NO_ERROR, ("cannot release mutex, arc=%ld\n", arc));
     999        }
     1000    }
     1001
     1002    /* store the answer */
     1003    data [1] = (void *) false;
     1004    /* signal we're done */
     1005    int vrc = RTThreadUserSignal (Thread);
     1006    AssertRC (vrc);
     1007
     1008    LogFlowFuncLeave();
     1009
     1010    return 0;
     1011}
     1012#endif
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r3387 r3480  
    278278#if defined(__WIN__)
    279279        unconst (mWatcherData.mUpdateReq) = ::CreateEvent (NULL, FALSE, FALSE, NULL);
     280#elif defined(__OS2__)
     281        RTSemEventCreate (&unconst (mWatcherData.mUpdateReq));
     282#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     283        RTSemEventCreate (&unconst (mWatcherData.mUpdateReq));
    280284#else
    281         RTSemEventCreate (&unconst (mWatcherData.mUpdateReq));
     285# error "Port me!"
    282286#endif
    283287        int vrc = RTThreadCreate (&unconst (mWatcherData.mThread),
    284                                   clientWatcher, (void *) this,
     288                                  ClientWatcher, (void *) this,
    285289                                  0, RTTHREADTYPE_MAIN_WORKER,
    286290                                  RTTHREADFLAGS_WAITABLE, "Watcher");
     
    293297    {
    294298        /* start the async event handler thread */
    295         int vrc = RTThreadCreate (&unconst (mAsyncEventThread), asyncEventHandler,
     299        int vrc = RTThreadCreate (&unconst (mAsyncEventThread), AsyncEventHandler,
    296300                                  &unconst (mAsyncEventQ),
    297301                                  0, RTTHREADTYPE_MAIN_WORKER,
     
    419423        unconst (mWatcherData.mUpdateReq) = NULL;
    420424    }
    421 #else
     425#elif defined(__OS2__)
    422426    if (mWatcherData.mUpdateReq != NIL_RTSEMEVENT)
    423427    {
     
    425429        unconst (mWatcherData.mUpdateReq) = NIL_RTSEMEVENT;
    426430    }
     431#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     432    if (mWatcherData.mUpdateReq != NIL_RTSEMEVENT)
     433    {
     434        RTSemEventDestroy (mWatcherData.mUpdateReq);
     435        unconst (mWatcherData.mUpdateReq) = NIL_RTSEMEVENT;
     436    }
     437#else
     438# error "Port me!"
    427439#endif
    428440
     
    23942406#if defined(__WIN__)
    23952407    ::SetEvent (mWatcherData.mUpdateReq);
     2408#elif defined(__OS2__)
     2409    RTSemEventSignal (mWatcherData.mUpdateReq);
     2410#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     2411    RTSemEventSignal (mWatcherData.mUpdateReq);
    23962412#else
    2397     RTSemEventSignal (mWatcherData.mUpdateReq);
     2413# error "Port me!"
    23982414#endif
    23992415}
     
    43474363 */
    43484364// static
    4349 DECLCALLBACK(int) VirtualBox::clientWatcher (RTTHREAD thread, void *pvUser)
     4365DECLCALLBACK(int) VirtualBox::ClientWatcher (RTTHREAD thread, void *pvUser)
    43504366{
    43514367    LogFlowFuncEnter();
     
    43554371
    43564372    SessionMachineVector machines;
    4357     int cnt = 0;
     4373    size_t cnt = 0;
    43584374
    43594375#if defined(__WIN__)
     
    44374453    ::CoUninitialize();
    44384454
    4439 #else
    4440 
    4441     bool need_update = false;
     4455#elif defined (__OS2__)
     4456
     4457    /// @todo (dmik) processes reaping!
     4458
     4459    /* according to PMREF, 64 is the maximum for the muxwait list */
     4460    SEMRECORD handles [64];
     4461
     4462    HMUX muxSem = NULLHANDLE;
    44424463
    44434464    do
    44444465    {
    44454466        AutoCaller autoCaller (that);
     4467        /* VirtualBox has been early uninitialized, terminate */
    44464468        if (!autoCaller.isOk())
    44474469            break;
     
    44524474            autoCaller.release();
    44534475
    4454             int rc = RTSemEventWait (that->mWatcherData.mUpdateReq, 500);
     4476            int vrc = RTSemEventWait (that->mWatcherData.mUpdateReq, 500);
    44554477
    44564478            /*
     
    44624484                break;
    44634485
     4486            bool update = false;
     4487
     4488            if (VBOX_SUCCESS (vrc))
     4489            {
     4490                /* update event is signaled */
     4491                update = true;
     4492            }
     4493            else
     4494            {
     4495                AssertMsg (vrc == VERR_TIMEOUT || vrc == VERR_INTERRUPTED,
     4496                           ("RTSemEventWait returned %Vrc\n", vrc));
     4497
     4498                /* are there any mutexes? */
     4499                if (cnt > 0)
     4500                {
     4501                    /* figure out what's going on with machines */
     4502
     4503                    unsigned long semId = 0;
     4504                    APIRET arc = ::DosWaitMuxWaitSem (muxSem,
     4505                                                      SEM_IMMEDIATE_RETURN, &semId);
     4506
     4507                    if (arc == NO_ERROR)
     4508                    {
     4509                        /* machine mutex is normally released */
     4510                        Assert (semId >= 0 && semId < cnt);
     4511                        if (semId >= 0 && semId < cnt)
     4512                            machines [semId]->checkForDeath();
     4513                        update = true;
     4514                    }
     4515                    else if (arc == ERROR_SEM_OWNER_DIED)
     4516                    {
     4517                        /* machine mutex is abandoned due to client process
     4518                         * termination; find which mutex is in the Owner Died
     4519                         * state */
     4520                        for (size_t i = 0; i < cnt; ++ i)
     4521                        {
     4522                            PID pid; TID tid;
     4523                            unsigned long reqCnt;
     4524                            arc = DosQueryMutexSem ((HMTX) handles [i].hsemCur, &pid,
     4525                                                    &tid, &reqCnt);
     4526                            if (arc == ERROR_SEM_OWNER_DIED)
     4527                            {
     4528                                /* close the dead mutex as asked by PMREF */
     4529                                ::DosCloseMutexSem ((HMTX) handles [i].hsemCur);
     4530
     4531                                Assert (i >= 0 && i < cnt);
     4532                                if (i >= 0 && i < cnt)
     4533                                    machines [i]->checkForDeath();
     4534                            }
     4535                        }
     4536                        update = true;
     4537                    }
     4538                    else
     4539                        AssertMsg (arc == ERROR_INTERRUPT || arc == ERROR_TIMEOUT,
     4540                                   ("DosWaitMuxWaitSem returned %d\n", arc));
     4541                }
     4542            }
     4543
     4544            if (update)
     4545            {
     4546                /* close the old muxsem */
     4547                if (muxSem != NULLHANDLE)
     4548                    ::DosCloseMuxWaitSem (muxSem);
     4549                /* obtain a new set of opened machines */
     4550                that->getOpenedMachines (machines);
     4551                cnt = machines.size();
     4552                LogFlowFunc (("UPDATE: direct session count = %d\n", cnt));
     4553                /// @todo use several muxwait sems if cnt is > 64
     4554                AssertMsg (cnt <= 64 /* according to PMREF */,
     4555                           ("maximum of 64 mutex semaphores reached (%d)", cnt));
     4556                if (cnt > 64)
     4557                    cnt = 64;
     4558                if (cnt > 0)
     4559                {
     4560                    /* renew the set of event handles */
     4561                    for (size_t i = 0; i < cnt; ++ i)
     4562                    {
     4563                        handles [i].hsemCur = (HSEM) machines [i]->ipcSem();
     4564                        handles [i].ulUser = i;
     4565                    }
     4566                    /* create a new muxsem */
     4567                    APIRET arc = ::DosCreateMuxWaitSem (NULL, &muxSem, cnt, handles,
     4568                                                        DCMW_WAIT_ANY);
     4569                    AssertMsg (arc == NO_ERROR,
     4570                               ("DosCreateMuxWaitSem returned %d\n", arc));
     4571                }
     4572            }
     4573        }
     4574        while (true);
     4575    }
     4576    while (0);
     4577
     4578    /* close the muxsem */
     4579    if (muxSem != NULLHANDLE)
     4580        ::DosCloseMuxWaitSem (muxSem);
     4581
     4582    /* delete the set of opened machines if any */
     4583    machines.clear();
     4584
     4585#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     4586
     4587    bool need_update = false;
     4588
     4589    do
     4590    {
     4591        AutoCaller autoCaller (that);
     4592        if (!autoCaller.isOk())
     4593            break;
     4594
     4595        do
     4596        {
     4597            /* release the caller to let uninit() ever proceed */
     4598            autoCaller.release();
     4599
     4600            int rc = RTSemEventWait (that->mWatcherData.mUpdateReq, 500);
     4601
     4602            /*
     4603             *  Restore the caller before using VirtualBox. If it fails, this
     4604             *  means VirtualBox is being uninitialized and we must terminate.
     4605             */
     4606            autoCaller.add();
     4607            if (!autoCaller.isOk())
     4608                break;
     4609
    44644610            if (VBOX_SUCCESS (rc) || need_update)
    44654611            {
     
    44734619
    44744620            need_update = false;
    4475             for (int i = 0; i < cnt; i++)
     4621            for (size_t i = 0; i < cnt; ++ i)
    44764622                need_update |= (machines [i])->checkForDeath();
    44774623
     
    45224668    machines.clear();
    45234669
     4670#else
     4671# error "Port me!"
    45244672#endif
    45254673
     
    45324680 */
    45334681// static
    4534 DECLCALLBACK(int) VirtualBox::asyncEventHandler (RTTHREAD thread, void *pvUser)
     4682DECLCALLBACK(int) VirtualBox::AsyncEventHandler (RTTHREAD thread, void *pvUser)
    45354683{
    45364684    LogFlowFuncEnter();
  • trunk/src/VBox/Main/include/MachineImpl.h

    r3424 r3480  
    756756
    757757    bool checkForDeath();
    758 #ifdef __WIN__
     758
     759#if defined (__WIN__)
    759760    HANDLE ipcSem() { return mIPCSem; }
     761#elif defined (__OS2__)
     762    HMTX ipcSem() { return mIPCSem; }
    760763#endif
    761764
     
    821824    HANDLE mIPCSem;
    822825    Bstr mIPCSemName;
     826#elif defined(__OS2__)
     827    HMTX mIPCSem;
     828    Bstr mIPCSemName;
    823829#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    824830    int mIPCSem;
     831#else
     832# error "Port me!"
    825833#endif
    826834
  • trunk/src/VBox/Main/include/SessionImpl.h

    r3001 r3480  
    125125    ComPtr <IVirtualBox> mVirtualBox;
    126126
    127     // the interprocess semaphore handle (id) for the opened machine
     127    /* interprocess semaphore handle (id) for the opened machine */
    128128#if defined(__WIN__)
    129129    HANDLE mIPCSem;
    130130    HANDLE mIPCThreadSem;
     131#elif defined(__OS2__)
     132    RTTHREAD mIPCThread;
     133    RTSEMEVENT mIPCThreadSem;
    131134#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    132135    int mIPCSem;
    133136#else
    134 # error "PORTME"
     137# error "Port me!"
    135138#endif
    136139};
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r2981 r3480  
    356356#if defined(__WIN__)
    357357            : mUpdateReq (NULL)
     358#elif defined(__OS2__)
     359            : mUpdateReq (NIL_RTSEMEVENT)
     360#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     361            : mUpdateReq (NIL_RTSEMEVENT)
    358362#else
    359             : mUpdateReq (NIL_RTSEMEVENT)
     363# error "Port me!"
    360364#endif
    361365            , mThread (NIL_RTTHREAD) {}
     
    364368#if defined(__WIN__)
    365369        const HANDLE mUpdateReq;
     370#elif defined(__OS2__)
     371        const RTSEMEVENT mUpdateReq;
     372#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     373        const RTSEMEVENT mUpdateReq;
    366374#else
    367         const RTSEMEVENT mUpdateReq;
     375# error "Port me!"
    368376#endif
    369377        const RTTHREAD mThread;
     
    382390    static Bstr sVersion;
    383391
    384     static DECLCALLBACK(int) clientWatcher (RTTHREAD thread, void *pvUser);
    385     static DECLCALLBACK(int) asyncEventHandler (RTTHREAD thread, void *pvUser);
     392    static DECLCALLBACK(int) ClientWatcher (RTTHREAD thread, void *pvUser);
     393    static DECLCALLBACK(int) AsyncEventHandler (RTTHREAD thread, void *pvUser);
    386394
    387395#ifdef __WIN__
  • trunk/src/VBox/Main/testcase/Makefile.kmk

    r3186 r3480  
    2727 PROGRAMS.linux = tstVBoxAPILinux
    2828 PROGRAMS.win   = tstVBoxAPIWin
     29else ifeq ($(USER),dmik)
     30 PROGRAMS       = tstAPI
    2931endif # VBOX_WITH_TESTCASES
    3032
  • trunk/src/VBox/Main/testcase/tstAPI.cpp

    r3422 r3480  
    705705#endif
    706706
    707 #if 0
     707#if 1
    708708    // open a (direct) session
    709709    ///////////////////////////////////////////////////////////////////////////
     
    718718        printf ("Opening a session for this machine...\n");
    719719        CHECK_RC_BREAK (virtualBox->OpenSession (session, guid));
    720 #if 0
     720#if 1
    721721        ComPtr <IMachine> sessionMachine;
    722722        printf ("Getting sessioned machine object...\n");
     
    763763        }
    764764#endif
     765        printf("Press enter to close session...");
     766        getchar();
    765767        session->Close();
    766768    }
Note: See TracChangeset for help on using the changeset viewer.

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