GuestProcessImpl.h revision b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93c
/* $Id$ */
/** @file
* VirtualBox Main - Guest process handling.
*/
/*
* Copyright (C) 2012-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ____H_GUESTPROCESSIMPL
#define ____H_GUESTPROCESSIMPL
#include "GuestCtrlImplPrivate.h"
#include "GuestProcessWrap.h"
/**
* Class for handling a guest process.
*/
{
* @{ */
int init(Console *aConsole, GuestSession *aSession, ULONG aProcessID, const GuestProcessStartupInfo &aProcInfo);
void uninit(void);
HRESULT FinalConstruct(void);
void FinalRelease(void);
/** @} */
/** @name Public internal methods.
* @{ */
int i_onRemove(void);
int i_startProcessAsync(void);
int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pGuestRc);
/** @} */
/** @name Protected internal methods.
* @{ */
inline bool i_isAlive(void);
inline bool i_hasEnded(void);
/** @} */
/** Wrapped @name IProcess data .
* @{ */
/** Wrapped @name IProcess methods.
* @{ */
/**
* This can safely be used without holding any locks.
* An AutoCaller suffices to prevent it being destroy while in use and
* internally there is a lock providing the necessary serialization.
*/
struct Data
{
/** The process startup information. */
/** Exit code if process has been terminated. */
/** PID reported from the guest. */
/** The current process status. */
/** The last returned process status
* returned from the guest side. */
int mLastError;
} mData;
};
/**
* Guest process tool flags.
*/
/** No flags specified; wait until process terminates.
* The maximum waiting time is set in the process' startup
* info. */
#define GUESTPROCESSTOOL_FLAG_NONE 0
/** Wait until next stream block from stdout has been
* read in completely, then return.
*/
#define GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK RT_BIT(0)
/**
* Internal class for handling a VBoxService tool ("vbox_ls", vbox_stat", ...).
*/
{
GuestProcessTool(void);
virtual ~GuestProcessTool(void);
int Init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pGuestRc);
bool i_isRunning(void);
static int i_run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pGuestRc);
};
#endif /* !____H_GUESTPROCESSIMPL */