Changeset 43162 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Sep 4, 2012 1:53:59 PM (12 years ago)
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r43061 r43162 71 71 72 72 /** 73 * Genericclass for a all guest control callbacks/events.73 * Base class for a all guest control callbacks/events. 74 74 */ 75 75 class GuestCtrlEvent … … 121 121 { 122 122 public: 123 123 124 GuestCtrlCallback(void); 124 125 … … 165 166 typedef std::map < uint32_t, GuestCtrlCallback* > GuestCtrlCallbacks; 166 167 167 struct GuestProcessWaitResult 168 { 169 GuestProcessWaitResult(void) 170 : mResult(ProcessWaitResult_None), 171 mRC(VINF_SUCCESS) { } 172 173 /** The wait result when returning from the wait call. */ 168 169 /* 170 * Class representing a guest control process waiting 171 * event. 172 */ 173 class GuestProcessWaitEvent : public GuestCtrlEvent 174 { 175 public: 176 177 GuestProcessWaitEvent(void); 178 179 GuestProcessWaitEvent(uint32_t uWaitFlags); 180 181 virtual ~GuestProcessWaitEvent(void); 182 183 public: 184 185 void Destroy(void); 186 187 int Init(uint32_t uWaitFlags); 188 189 uint32_t GetWaitFlags(void) { return ASMAtomicReadU32(&mFlags); } 190 191 ProcessWaitResult_T GetWaitResult(void) { return mResult; } 192 193 int GetWaitRc(void) { return mRC; } 194 195 int Signal(ProcessWaitResult_T enmResult, int rc = VINF_SUCCESS); 196 197 protected: 198 199 /** The waiting flag(s). The specifies what to 200 * wait for. See ProcessWaitFlag_T. */ 201 uint32_t mFlags; 202 /** Structure containing the overall result. */ 174 203 ProcessWaitResult_T mResult; 175 /** Optional rc to this result. */176 int mRC;177 };178 179 180 /*181 * Class representing a guest control process event.182 */183 class GuestProcessEvent : public GuestCtrlEvent184 {185 public:186 GuestProcessEvent(void);187 188 GuestProcessEvent(uint32_t uWaitFlags);189 190 virtual ~GuestProcessEvent(void);191 192 public:193 194 void Destroy(void);195 196 int Init(uint32_t uWaitFlags);197 198 uint32_t GetWaitFlags(void) { return ASMAtomicReadU32(&mWaitFlags); }199 200 GuestProcessWaitResult GetResult(void) { return mWaitResult; }201 202 int Signal(ProcessWaitResult_T enmResult, int rc = VINF_SUCCESS);203 204 protected:205 206 /** The waiting flag(s). The specifies what to207 * wait for. */208 uint32_t mWaitFlags;209 /** Structure containing the overall result. */210 GuestProcessWaitResult mWaitResult;211 204 }; 212 205 -
trunk/src/VBox/Main/include/GuestDirectoryImpl.h
r42897 r43162 21 21 22 22 #include "VirtualBoxBase.h" 23 #include "Guest CtrlImplPrivate.h"23 #include "GuestProcessImpl.h" 24 24 25 class GuestProcess;26 25 class GuestSession; 27 26 … … 45 44 DECLARE_EMPTY_CTOR_DTOR(GuestDirectory) 46 45 47 int init(GuestSession *aSession, const Utf8Str &strPath, const Utf8Str &strFilter = "", uint32_t uFlags = 0);46 int init(GuestSession *aSession, const Utf8Str &strPath, const Utf8Str &strFilter, uint32_t uFlags); 48 47 void uninit(void); 49 48 HRESULT FinalConstruct(void); … … 68 67 /** @name Private internal methods. 69 68 * @{ */ 70 int parseData(GuestProcessStreamBlock &streamBlock);71 69 /** @} */ 72 70 … … 77 75 Utf8Str mFilter; 78 76 uint32_t mFlags; 79 /** The stdout stream object which contains all 80 * read out data for parsing. Must be persisent 81 * between several read() calls. */ 82 GuestProcessStream mStream; 83 /** The guest process which is responsible for 84 * getting the stdout stream. */ 85 GuestProcess *mProcess; 77 GuestProcessTool mProcessTool; 86 78 } mData; 87 79 }; -
trunk/src/VBox/Main/include/GuestFileImpl.h
r42897 r43162 46 46 DECLARE_EMPTY_CTOR_DTOR(GuestFile) 47 47 48 int init(GuestSession *pSession, const Utf8Str &strPath, const Utf8Str &strOpenMode, const Utf8Str &strDisposition, uint32_t uCreationMode, int64_t iOffset );48 int init(GuestSession *pSession, const Utf8Str &strPath, const Utf8Str &strOpenMode, const Utf8Str &strDisposition, uint32_t uCreationMode, int64_t iOffset, int *pGuestRc); 49 49 void uninit(void); 50 50 HRESULT FinalConstruct(void); -
trunk/src/VBox/Main/include/GuestProcessImpl.h
r42897 r43162 75 75 inline bool callbackExists(uint32_t uContextID); 76 76 inline int checkPID(uint32_t uPID); 77 Utf8Str errorMsg(void) { return mData.mErrorMsg; }77 static Utf8Str guestErrorToString(int guestRc); 78 78 bool isReady(void); 79 79 ULONG getProcessID(void) { return mData.mProcessID; } 80 int r c(void) { return mData.mRC; }81 int readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, size_t *pcbRead);82 int startProcess( void);80 int readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, size_t *pcbRead, int *pGuestRc); 81 static HRESULT setErrorExternal(VirtualBoxBase *pInterface, int guestRc); 82 int startProcess(int *pGuestRc); 83 83 int startProcessAsync(void); 84 84 int terminateProcess(void); 85 int waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestProcessWaitResult &guestResult); 86 int waitForStart(uint32_t uTimeoutMS); 87 int writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten); 85 int waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pGuestRc); 86 int writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc); 88 87 /** @} */ 89 88 … … 101 100 int prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars); 102 101 int sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms); 103 int setErrorInternal(int rc, const Utf8Str &strMessage); 104 HRESULT setErrorExternal(void); 105 int signalWaiters(ProcessWaitResult_T enmWaitResult); 102 int setProcessStatus(ProcessStatus_T procStatus, int procRc); 103 int signalWaiters(ProcessWaitResult_T enmWaitResult, int rc = VINF_SUCCESS); 106 104 static DECLCALLBACK(int) startProcessThread(RTTHREAD Thread, void *pvUser); 107 105 /** @} */ … … 130 128 /** The current process status. */ 131 129 ProcessStatus_T mStatus; 132 /** The overall rc of the process execution. */133 130 int mRC; 134 /** The overall error message of the135 * process execution. */136 Utf8Str mErrorMsg;137 131 /** The next upcoming context ID. */ 138 132 ULONG mNextContextID; … … 144 138 /** The actual process event for doing the waits. 145 139 * At the moment we only support one wait a time. */ 146 GuestProcess Event*mWaitEvent;140 GuestProcessWaitEvent *mWaitEvent; 147 141 } mData; 142 }; 143 144 /** 145 * Guest process tool flags. 146 */ 147 /** No flags specified. */ 148 #define GUESTPROCESSTOOL_FLAG_NONE 0 149 /** Run until next stream block from stdout has been 150 * read in completely, then return. 151 */ 152 #define GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK RT_BIT(0) 153 154 /** 155 * Internal class for handling a VBoxService tool ("vbox_ls", vbox_stat", ...). 156 */ 157 class GuestProcessTool 158 { 159 public: 160 161 GuestProcessTool(void); 162 163 virtual ~GuestProcessTool(void); 164 165 public: 166 167 int Init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pGuestRc); 168 169 GuestProcessStream &GetStdOut(void) { return mStdOut; } 170 171 GuestProcessStream &GetStdErr(void) { return mStdErr; } 172 173 int Wait(uint32_t fFlags, int *pGuestRc); 174 175 int WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStreamBlock, int *pGuestRc); 176 177 int GetCurrentBlock(uint32_t uHandle, GuestProcessStreamBlock &strmBlock); 178 179 bool IsRunning(void); 180 181 int TerminatedOk(LONG *pExitCode); 182 183 void Terminate(void); 184 185 protected: 186 187 GuestSession *pSession; 188 ComObjPtr<GuestProcess> pProcess; 189 GuestProcessStartupInfo mStartupInfo; 190 GuestProcessStream mStdOut; 191 GuestProcessStream mStdErr; 148 192 }; 149 193 -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r43002 r43162 297 297 * @{ */ 298 298 int directoryRemoveFromList(GuestDirectory *pDirectory); 299 int directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags); 300 int objectCreateTempInternal(Utf8Str strTemplate, 301 Utf8Str strPath, 302 bool fDirectory, 303 Utf8Str &strName, 304 int *prc); 299 int directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc); 300 int objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, const Utf8Str &strName, int *pGuestRc); 305 301 int directoryOpenInternal(const Utf8Str &strPath, const Utf8Str &strFilter, uint32_t uFlags, ComObjPtr<GuestDirectory> &pDirectory); 306 int directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData );302 int directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc); 307 303 int dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData); 308 304 int fileRemoveFromList(GuestFile *pFile); 309 int fileRemoveInternal( Utf8Str strPath, int *prc);305 int fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc); 310 306 int fileOpenInternal(const Utf8Str &strPath, const Utf8Str &strOpenMode, const Utf8Str &strDisposition, 311 uint32_t uCreationMode, int64_t iOffset, ComObjPtr<GuestFile> &pFile );312 int fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData );313 int fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize );314 int fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData );307 uint32_t uCreationMode, int64_t iOffset, ComObjPtr<GuestFile> &pFile, int *pGuestRc); 308 int fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc); 309 int fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc); 310 int fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc); 315 311 const GuestCredentials &getCredentials(void); 316 312 const GuestEnvironment &getEnvironment(void);
Note:
See TracChangeset
for help on using the changeset viewer.