Changeset 47859 in vbox
- Timestamp:
- Aug 19, 2013 9:06:45 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/user_VBoxManage.xml
r47632 r47859 3263 3263 <listitem> 3264 3264 <para><emphasis role="bold"><computeroutput>list</computeroutput></emphasis>, 3265 which lists various guest control information such as open guest sessions and3266 guest processes .</para>3265 which lists various guest control information such as open guest sessions, 3266 guest processes and guest files.</para> 3267 3267 3268 3268 <screen>VBoxManage guestcontrol <uuid|vmname> list 3269 <all|sessions|processes > [--verbose]</screen>3269 <all|sessions|processes|files> [--verbose]</screen> 3270 3270 3271 3271 <para>where the parameters mean: <glosslist> … … 3279 3279 3280 3280 <glossentry> 3281 <glossterm><computeroutput>all|sessions|processes </computeroutput></glossterm>3281 <glossterm><computeroutput>all|sessions|processes|files</computeroutput></glossterm> 3282 3282 3283 3283 <glossdef> 3284 <para>Whether to list guest sessions, guest processes or all information3285 available.</para>3284 <para>Whether to list guest sessions, guest processes, guest files 3285 or all information available. Mandatory.</para> 3286 3286 </glossdef> 3287 3287 </glossentry> -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r47696 r47859 83 83 void uninit(void) 84 84 { 85 mSession.setNull(); 85 86 } 86 87 … … 89 90 switch (aType) 90 91 { 92 case VBoxEventType_OnGuestFileRegistered: 93 break; 94 95 case VBoxEventType_OnGuestProcessRegistered: 96 break; 97 91 98 case VBoxEventType_OnGuestSessionRegistered: 92 99 { 93 ComPtr<IGuestSessionRegisteredEvent> pEvent = aEvent; 94 Assert(!pEvent.isNull()); 95 96 ComPtr<IGuestSession> pSession; 97 HRESULT rc = pEvent->COMGETTER(Session)(pSession.asOutParam()); 98 AssertComRCBreakRC(rc); 99 AssertBreak(!pSession.isNull()); 100 101 BOOL fRegistered; 102 rc = pEvent->COMGETTER(Registered)(&fRegistered); 103 AssertComRCBreakRC(rc); 104 105 Bstr strName; 106 rc = pSession->COMGETTER(Name)(strName.asOutParam()); 107 AssertComRCBreakRC(rc); 108 ULONG uID; 109 rc = pSession->COMGETTER(Id)(&uID); 110 AssertComRCBreakRC(rc); 111 112 RTPrintf("Session ID=%RU32 \"%s\" %s\n", 113 uID, Utf8Str(strName).c_str(), 114 fRegistered ? "registered" : "unregistered"); 115 116 pSession.setNull(); 100 HRESULT rc; 101 do 102 { 103 ComPtr<IGuestSessionRegisteredEvent> pEvent = aEvent; 104 Assert(!pEvent.isNull()); 105 106 CHECK_ERROR_BREAK(pEvent, COMGETTER(Session)(mSession.asOutParam())); 107 AssertBreak(!mSession.isNull()); 108 BOOL fRegistered; 109 CHECK_ERROR_BREAK(pEvent, COMGETTER(Registered)(&fRegistered)); 110 Bstr strName; 111 CHECK_ERROR_BREAK(mSession, COMGETTER(Name)(strName.asOutParam())); 112 ULONG uID; 113 CHECK_ERROR_BREAK(mSession, COMGETTER(Id)(&uID)); 114 115 RTPrintf("Session ID=%RU32 \"%s\" %s\n", 116 uID, Utf8Str(strName).c_str(), 117 fRegistered ? "registered" : "unregistered"); 118 if (fRegistered) 119 { 120 #if 0 121 /* Register for IGuestSession events. */ 122 ComPtr<IEventSource> es; 123 CHECK_ERROR_BREAK(pSession, COMGETTER(EventSource)(es.asOutParam())); 124 com::SafeArray<VBoxEventType_T> eventTypes; 125 eventTypes.push_back(VBoxEventType_OnGuestFileRegistered); 126 eventTypes.push_back(VBoxEventType_OnGuestProcessRegistered); 127 CHECK_ERROR_BREAK(es, RegisterListener(this, ComSafeArrayAsInParam(eventTypes), 128 true /* Active listener */)); 129 #endif 130 } 131 else 132 { 133 mSession.setNull(); 134 } 135 136 } while (0); 117 137 break; 118 138 } … … 124 144 return S_OK; 125 145 } 146 147 protected: 148 149 ComPtr<IGuestSession> mSession; 126 150 }; 127 151 typedef ListenerImpl<GuestEventListener> GuestEventListenerImpl; … … 329 353 " [--domain <domain>] [--mode <mode>] [--verbose]\n" 330 354 "\n" 331 " list <all|sessions|processes > [--verbose]\n"355 " list <all|sessions|processes|files> [--verbose]\n" 332 356 "\n" 333 357 /** @todo Add an own help group for "session" and "process" sub commands. */ … … 560 584 } 561 585 586 /** 587 * Translates a guest file status to a human readable 588 * string. 589 */ 590 static const char *ctrlFileStatusToText(FileStatus_T enmStatus) 591 { 592 switch (enmStatus) 593 { 594 case FileStatus_Opening: 595 return "opening"; 596 case FileStatus_Open: 597 return "open"; 598 case FileStatus_Closing: 599 return "closing"; 600 case FileStatus_Closed: 601 return "closed"; 602 case FileStatus_Down: 603 return "killed"; 604 case FileStatus_Error: 605 return "error"; 606 default: 607 break; 608 } 609 return "unknown"; 610 } 611 562 612 static int ctrlPrintError(com::ErrorInfo &errorInfo) 563 613 { … … 2979 3029 bool fListSessions = false; 2980 3030 bool fListProcesses = false; 3031 bool fListFiles = false; 2981 3032 if ( !RTStrICmp(pArg->argv[0], "sessions") 2982 3033 || !RTStrICmp(pArg->argv[0], "sess")) … … 2985 3036 || !RTStrICmp(pArg->argv[0], "procs")) 2986 3037 fListSessions = fListProcesses = true; /* Showing processes implies showing sessions. */ 3038 else if ( !RTStrICmp(pArg->argv[0], "files")) 3039 fListSessions = fListFiles = true; /* Showing files implies showing sessions. */ 2987 3040 else if (!RTStrICmp(pArg->argv[0], "all")) 2988 3041 fListAll = true; … … 2998 3051 { 2999 3052 size_t cTotalProcs = 0; 3053 size_t cTotalFiles = 0; 3000 3054 3001 3055 SafeIfaceArray <IGuestSession> collSessions; … … 3049 3103 cTotalProcs += collProcesses.size(); 3050 3104 } 3105 3106 if ( fListAll 3107 || fListFiles) 3108 { 3109 SafeIfaceArray <IGuestFile> collFiles; 3110 CHECK_ERROR_BREAK(pCurSession, COMGETTER(Files)(ComSafeArrayAsOutParam(collFiles))); 3111 for (size_t a = 0; a < collFiles.size(); a++) 3112 { 3113 ComPtr<IGuestFile> pCurFile = collFiles[a]; 3114 if (!pCurFile.isNull()) 3115 { 3116 ULONG uID; 3117 CHECK_ERROR_BREAK(pCurFile, COMGETTER(Id)(&uID)); 3118 Bstr strName; 3119 CHECK_ERROR_BREAK(pCurFile, COMGETTER(FileName)(strName.asOutParam())); 3120 FileStatus_T fileStatus; 3121 CHECK_ERROR_BREAK(pCurFile, COMGETTER(Status)(&fileStatus)); 3122 3123 RTPrintf("\n\t\tFile #%-03zu PID=%-6RU32 Status=[%s] Name=%ls", 3124 a, uID, ctrlFileStatusToText(fileStatus), strName.raw()); 3125 } 3126 } 3127 3128 cTotalFiles += collFiles.size(); 3129 } 3051 3130 } 3052 3131 } 3053 3132 3054 3133 RTPrintf("\n\nTotal guest sessions: %zu\n", collSessions.size()); 3055 RTPrintf("Total guest processes: %zu\n", cTotalProcs); 3134 if (fListAll || fListProcesses) 3135 RTPrintf("Total guest processes: %zu\n", cTotalProcs); 3136 if (fListAll || fListFiles) 3137 RTPrintf("Total guest files: %zu\n", cTotalFiles); 3056 3138 } 3057 3139 else … … 3480 3562 { 3481 3563 ComObjPtr<GuestEventListenerImpl> pGuestListener; 3482 3483 3484 3485 3564 do 3486 3565 {
Note:
See TracChangeset
for help on using the changeset viewer.