Changeset 1077 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 27, 2007 5:33:11 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18964
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r1071 r1077 795 795 } 796 796 797 STDMETHODIMP Machine::COMGETTER(Description) (BSTR *aDescription) 798 { 799 if (!aDescription) 800 return E_POINTER; 801 802 AutoCaller autoCaller (this); 803 CheckComRCReturnRC (autoCaller.rc()); 804 805 AutoReaderLock alock (this); 806 807 mUserData->mDescription.cloneTo (aDescription); 808 809 return S_OK; 810 } 811 812 STDMETHODIMP Machine::COMSETTER(Description) (INPTR BSTR aDescription) 813 { 814 AutoCaller autoCaller (this); 815 CheckComRCReturnRC (autoCaller.rc()); 816 817 AutoLock alock (this); 818 819 CHECK_SETTER(); 820 821 mUserData.backup(); 822 mUserData->mDescription = aDescription; 823 824 return S_OK; 825 } 826 797 827 STDMETHODIMP Machine::COMGETTER(Id) (GUIDPARAMOUT aId) 798 828 { … … 1177 1207 } 1178 1208 1179 STDMETHODIMP Machine::COMGETTER(SessionState) (SessionState_T * sessionState)1180 { 1181 if (! sessionState)1209 STDMETHODIMP Machine::COMGETTER(SessionState) (SessionState_T *aSessionState) 1210 { 1211 if (!aSessionState) 1182 1212 return E_POINTER; 1183 1213 … … 1187 1217 AutoReaderLock alock (this); 1188 1218 1189 *sessionState = mData->mSession.mState; 1219 *aSessionState = mData->mSession.mState; 1220 1221 return S_OK; 1222 } 1223 1224 STDMETHODIMP Machine::COMGETTER(SessionType) (BSTR *aSessionType) 1225 { 1226 if (!aSessionType) 1227 return E_POINTER; 1228 1229 AutoCaller autoCaller (this); 1230 CheckComRCReturnRC (autoCaller.rc()); 1231 1232 AutoReaderLock alock (this); 1233 1234 mData->mSession.mType.cloneTo (aSessionType); 1235 1236 return S_OK; 1237 } 1238 1239 STDMETHODIMP Machine::COMGETTER(SessionPid) (ULONG *aSessionPid) 1240 { 1241 if (!aSessionPid) 1242 return E_POINTER; 1243 1244 AutoCaller autoCaller (this); 1245 CheckComRCReturnRC (autoCaller.rc()); 1246 1247 AutoReaderLock alock (this); 1248 1249 *aSessionPid = mData->mSession.mPid; 1190 1250 1191 1251 return S_OK; … … 2367 2427 AssertReturn (mData->mMachineState < MachineState_Running, E_FAIL); 2368 2428 2429 /* get the sesion PID */ 2430 RTPROCESS pid = NIL_RTPROCESS; 2431 AssertCompile (sizeof (ULONG) == sizeof (RTPROCESS)); 2432 aControl->GetPID ((ULONG *) &pid); 2433 Assert (pid != NIL_RTPROCESS); 2434 2369 2435 if (mData->mSession.mState == SessionState_SessionSpawning) 2370 2436 { 2371 /* 2372 * this machine awaits for a spawning session to be opened, 2373 * so reject any other open attempts from processes other than 2374 * one started by #openRemoteSession(). 2375 */ 2376 2377 RTPROCESS pid = NIL_RTPROCESS; AssertCompile (sizeof (ULONG) == sizeof (RTPROCESS)); 2378 aControl->GetPID ((ULONG *)&pid); 2437 /* This machine is awaiting for a spawning session to be opened, so 2438 * reject any other open attempts from processes other than one 2439 * started by #openRemoteSession(). */ 2379 2440 2380 2441 LogFlowThisFunc (("mSession.mPid=%d(0x%x)\n", … … 2476 2537 /* Note that the progress object is finalized later */ 2477 2538 2478 /* We don't reset mSession.mPid here because it is necessary for 2479 * SessionMachine::uninit() to reap the child process later. */ 2539 /* We don't reset mSession.mPid and mType here because both are 2540 * necessary for SessionMachine::uninit() to reap the child process 2541 * later. */ 2480 2542 2481 2543 if (FAILED (rc)) … … 2486 2548 mData->mSession.mState = SessionState_SessionClosed; 2487 2549 } 2550 } 2551 else 2552 { 2553 /* memorize PID of the directly opened session */ 2554 if (SUCCEEDED (rc)) 2555 mData->mSession.mPid = pid; 2488 2556 } 2489 2557 … … 2636 2704 mData->mSession.mPid = pid; 2637 2705 mData->mSession.mState = SessionState_SessionSpawning; 2706 mData->mSession.mType = type; 2638 2707 2639 2708 LogFlowThisFuncLeave(); … … 3055 3124 CFGLDRQueryBool (machineNode, "nameSync", &nameSync); 3056 3125 mUserData->mNameSync = nameSync; 3126 } 3127 3128 /* Description (optional, default is null) */ 3129 { 3130 CFGNODE descNode = 0; 3131 CFGLDRGetChildNode (machineNode, "Description", 0, &descNode); 3132 if (descNode) 3133 { 3134 CFGLDRQueryBSTR (descNode, NULL, 3135 mUserData->mDescription.asOutParam()); 3136 CFGLDRReleaseNode (descNode); 3137 } 3138 else 3139 mUserData->mDescription.setNull(); 3057 3140 } 3058 3141 … … 3290 3373 CFGNODE descNode = 0; 3291 3374 CFGLDRGetChildNode (aNode, "Description", 0, &descNode); 3292 CFGLDRQueryBSTR (descNode, NULL, description.asOutParam()); 3293 CFGLDRReleaseNode (descNode); 3375 if (descNode) 3376 { 3377 CFGLDRQueryBSTR (descNode, NULL, description.asOutParam()); 3378 CFGLDRReleaseNode (descNode); 3379 } 3294 3380 } 3295 3381 … … 4682 4768 CFGLDRDeleteAttribute (machineNode, "nameSync"); 4683 4769 4770 /* Description node (optional) */ 4771 if (!mUserData->mDescription.isNull()) 4772 { 4773 CFGNODE descNode = 0; 4774 CFGLDRCreateChildNode (machineNode, "Description", &descNode); 4775 Assert (descNode); 4776 CFGLDRSetBSTR (descNode, NULL, mUserData->mDescription); 4777 CFGLDRReleaseNode (descNode); 4778 } 4779 else 4780 { 4781 CFGNODE descNode = 0; 4782 CFGLDRGetChildNode (machineNode, "Description", 0, &descNode); 4783 if (descNode) 4784 CFGLDRDeleteNode (descNode); 4785 } 4786 4684 4787 /* OSType (required) */ 4685 4788 { … … 5099 5202 5100 5203 /* Description node (optional) */ 5204 if (!aSnapshot->data().mDescription.isNull()) 5101 5205 { 5102 5206 CFGNODE descNode = 0; 5103 5207 CFGLDRCreateChildNode (aNode, "Description", &descNode); 5208 Assert (descNode); 5104 5209 CFGLDRSetBSTR (descNode, NULL, aSnapshot->data().mDescription); 5105 5210 CFGLDRReleaseNode (descNode); 5211 } 5212 else 5213 { 5214 CFGNODE descNode = 0; 5215 CFGLDRGetChildNode (aNode, "Description", 0, &descNode); 5216 if (descNode) 5217 CFGLDRDeleteNode (descNode); 5106 5218 } 5107 5219 … … 7086 7198 mParent->host()->releaseAllUSBDevices (this); 7087 7199 7088 if ( mData->mSession.mPid != NIL_RTPROCESS)7089 { 7090 /* 7091 * pid is not NIL, meaning this machine's process has been started7092 * using VirtualBox::OpenRemoteSession(), thus it is our child.7093 * we need to queue this pid to be reaped (to avoid zombies on Linux)7094 */7200 if (!mData->mSession.mType.isNull()) 7201 { 7202 /* mType is not null when this machine's process has been started by 7203 * VirtualBox::OpenRemoteSession(), therefore it is our child. We 7204 * need to queue the PID to reap the process (and avoid zombies on 7205 * Linux). */ 7206 Assert (mData->mSession.mPid != NIL_RTPROCESS); 7095 7207 mParent->addProcessToReap (mData->mSession.mPid); 7096 mData->mSession.mPid = NIL_RTPROCESS; 7097 } 7208 } 7209 7210 mData->mSession.mPid = NIL_RTPROCESS; 7098 7211 7099 7212 if (aReason == Uninit::Unexpected) 7100 7213 { 7101 /* 7102 * uninitialization didn't come from #checkForDeath(), so tell the 7103 * client watcher thread to update the set of machines that have 7104 * open sessions. 7105 */ 7214 /* Uninitialization didn't come from #checkForDeath(), so tell the 7215 * client watcher thread to update the set of machines that have open 7216 * sessions. */ 7106 7217 mParent->updateClientWatcher(); 7107 7218 } … … 7162 7273 mData->mSession.mMachine.setNull(); 7163 7274 mData->mSession.mState = SessionState_SessionClosed; 7275 mData->mSession.mType.setNull(); 7164 7276 7165 7277 /* close the interprocess semaphore before leaving the shared lock */ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r953 r1077 1369 1369 it is invalid. 1370 1370 </p> 1371 1372 Currently supported session types (values of the @a type 1373 parameter) are: 1374 <ul> 1375 <li><tt>gui</tt>: VirtualBox Qt GUI session</li> 1376 <li><tt>vrdp</tt>: VirtualBox VRDP Server session</li> 1377 </ul> 1378 1371 1379 <note> 1372 1380 It is impossible to open a remote session with the machine … … 1375 1383 (see <link to="IMachine::sessionState"/>). 1376 1384 </note> 1385 1386 <note> 1387 The opened @a session will be automatically closed when 1388 the corresponding direct session dies or gets closed. 1389 </note> 1390 1377 1391 <see>openExistingSession</see> 1378 1392 </desc> … … 1380 1394 <desc> 1381 1395 Session object that will represent the opened remote session 1382 after successful method invocation. This object must not 1383 represent an already open session. 1384 <note> 1385 This session will be automatically closed when the peer 1386 (direct) session dies or gets closed. 1387 </note> 1396 after successful method invocation (this object must not 1397 represent an already open session). 1388 1398 </desc> 1389 1399 </param> … … 1393 1403 <param name="type" type="wstring" dir="in"> 1394 1404 <desc> 1395 Type of the remote session (case sensitive). Currently 1396 supported values are: 1397 <ul> 1398 <li><tt>gui</tt>: Qt-based VM session</li> 1399 <li><tt>rdp</tt>: VRDP server session</li> 1400 </ul> 1405 Type of the remote session (case sensitive). 1401 1406 </desc> 1402 1407 </param> … … 1760 1765 <interface 1761 1766 name="IMachine" extends="$unknown" 1762 uuid=" FD443EC1-0009-4F5B-9282-D72760A66916"1767 uuid="50fa9181-d2d4-45ca-bf0e-742677b9c707" 1763 1768 > 1764 1769 <attribute name="parent" type="IVirtualBox" readonly="yes"> … … 1876 1881 </attribute> 1877 1882 1883 <attribute name="description" type="wstring"> 1884 <desc> 1885 Description of the virtual machine. 1886 1887 The description attribute can contain any text and is 1888 typically used to describe the hardware and software 1889 configuration of the virtual machine in detail (i.e. network 1890 settings, versions of the installed software and so on). 1891 </desc> 1892 </attribute> 1893 1878 1894 <attribute name="id" type="uuid" readonly="yes"> 1879 1895 <desc>UUID of the virtual machine.</desc> … … 2001 2017 <attribute name="sessionState" type="SessionState" readonly="yes"> 2002 2018 <desc>Current session state for this machine.</desc> 2019 </attribute> 2020 2021 <attribute name="sessionType" type="wstring" readonly="yes"> 2022 <desc> 2023 Type of the session. If <link to="#sessionState"/> is 2024 SessionSpawning or SessionOpen, this attribute contains the 2025 same value as passed to the 2026 <link to="IVirtualBox::openRemoteSession()"/> method in the @a 2027 type parameter. If the session was opened directly using 2028 <link to="IVirtualBox::openSession()"/>, or if 2029 <link to="#sessionState"/> is SessionClosed, the value of this 2030 attribute is @c null. 2031 </desc> 2032 </attribute> 2033 2034 <attribute name="sessionPid" type="unsigned long" readonly="yes"> 2035 <desc> 2036 Identifier of the session process. This attribute contains the 2037 platform-dependent identifier of the process that has opened a 2038 direct session for this machine using the 2039 <link to="IVirtualBox::openSession()"/> call. The returned value 2040 is only valid if <link to="#sessionState"/> is SessionOpen or 2041 SessionClosing (i.e. a session is currently open or being 2042 closed) by the time this property is read. 2043 </desc> 2003 2044 </attribute> 2004 2045 -
trunk/src/VBox/Main/include/MachineImpl.h
r606 r1077 142 142 RTPROCESS mPid; 143 143 144 /** current session state */144 /** Current session state */ 145 145 SessionState_T mState; 146 146 147 /** sesison machine object */ 147 /** Session type string (for indirect sessions) */ 148 Bstr mType; 149 150 /** Sesison machine object */ 148 151 ComObjPtr <SessionMachine> mMachine; 149 152 }; … … 210 213 (mName == that.mName && 211 214 mNameSync == that.mNameSync && 215 mDescription == that.mDescription && 212 216 mOSType.equalsTo (that.mOSType) && 213 217 mSnapshotFolderFull == that.mSnapshotFolderFull); 214 218 } 215 219 216 Bstr mName; 217 BOOL mNameSync; 220 Bstr mName; 221 BOOL mNameSync; 222 Bstr mDescription; 218 223 ComPtr <IGuestOSType> mOSType; 219 Bstr mSnapshotFolder;220 Bstr mSnapshotFolderFull;224 Bstr mSnapshotFolder; 225 Bstr mSnapshotFolderFull; 221 226 }; 222 227 … … 305 310 STDMETHOD(COMGETTER(Name))(BSTR *aName); 306 311 STDMETHOD(COMSETTER(Name))(INPTR BSTR aName); 312 STDMETHOD(COMGETTER(Description))(BSTR *aDescription); 313 STDMETHOD(COMSETTER(Description))(INPTR BSTR aDescription); 307 314 STDMETHOD(COMGETTER(Id))(GUIDPARAMOUT aId); 308 315 STDMETHOD(COMGETTER(OSType)) (IGuestOSType **aOSType); … … 325 332 STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *filePath); 326 333 STDMETHOD(COMGETTER(SettingsModified))(BOOL *modified); 327 STDMETHOD(COMGETTER(SessionState))(SessionState_T *sessionState); 334 STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState); 335 STDMETHOD(COMGETTER(SessionType))(BSTR *aSessionType); 336 STDMETHOD(COMGETTER(SessionPid))(ULONG *aSessionPid); 328 337 STDMETHOD(COMGETTER(State))(MachineState_T *machineState); 329 338 STDMETHOD(COMGETTER(LastStateChange))(LONG64 *aLastStateChange); -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r1015 r1077 553 553 <xsd:complexType name="TMachine"> 554 554 <xsd:all> 555 <xsd:element name="Description" type="xsd:string" minOccurs="0"/> 555 556 <xsd:element name="Hardware" type="THardware"/> 556 557 <xsd:element name="HardDiskAttachments" type="THardDiskAttachments"/> -
trunk/src/VBox/Main/xml/samples/VirtualBox-machine-windows.xml
r1 r1077 20 20 aborted="true" 21 21 > 22 <Description> 23 Something is here. 24 </Description> 22 25 <Hardware> 23 26 <Memory RAMSize="128"/>
Note:
See TracChangeset
for help on using the changeset viewer.