RSysMonSession Class Reference

class RSysMonSession : public RSessionBase

Client API for monitoring the applications and processes using System Monitor Client can use this class to register for process/application monitoring. Upon failure of the process/application, System Monitor will try to restart the process according to the supplied parameters. If the process still fail to start after the retry limit is reached or if the relaunch attempts exceeds the rate of failure policy, the recovery action will be taken. The retry action can be ignore failure, restart the system, or restart the system with a specified startup mode, and different PlatSec capability is required for each option. See API description for PlatSec capability required.

Inherits from

Public Member Functions
RSysMonSession()
IMPORT_C TIntCancelAllMonitors()
IMPORT_C voidCancelMonitorSelfL()
IMPORT_C voidClose()
IMPORT_C voidMonitorL(const CStartupProperties &, const RProcess &, TBool)
IMPORT_C voidMonitorL(const CSsmStartupProperties &, const RProcess &, TBool)
IMPORT_C voidMonitorSelfL(const CStartupProperties &)
IMPORT_C voidMonitorSelfL(const CSsmStartupProperties &)
IMPORT_C voidOpenL()
Private Member Functions
CStartupProperties *ChangeToOldStylePropertiesL(const CSsmStartupProperties &)
voidDoMonitorL(const CStartupProperties &, const RProcess *, TBool)
TInt Validate(const CStartupProperties &)
Inherited Functions
RHandleBase::Attributes()const
RHandleBase::BTraceId()const
RHandleBase::DoExtendedClose()
RHandleBase::Duplicate(const RThread &,TOwnerType)
RHandleBase::FullName()const
RHandleBase::FullName(TDes &)const
RHandleBase::Handle()const
RHandleBase::HandleInfo(THandleInfo *)
RHandleBase::Name()const
RHandleBase::NotifyDestruction(TRequestStatus &)
RHandleBase::Open(const TFindHandleBase &,TOwnerType)
RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
RHandleBase::RHandleBase()
RHandleBase::RHandleBase(TInt)
RHandleBase::SetHandle(TInt)
RHandleBase::SetHandleNC(TInt)
RSessionBase::CreateSession(RServer2,const TVersion &)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TRequestStatus *)
RSessionBase::Open(RMessagePtr2,TInt,TOwnerType)
RSessionBase::Open(RMessagePtr2,TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Open(TInt,TOwnerType)
RSessionBase::Open(TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Send(TInt)const
RSessionBase::Send(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt)const
RSessionBase::SendReceive(TInt,TRequestStatus &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSessionBase::SetReturnedHandle(TInt)
RSessionBase::SetReturnedHandle(TInt,RHandleBase &)
RSessionBase::SetReturnedHandle(TInt,const TSecurityPolicy &)
RSessionBase::ShareAuto()
RSessionBase::ShareProtected()
Inherited Enumerations
RHandleBase:TAttributes
RSessionBase:TAttachMode
Inherited Attributes
RHandleBase::iHandle

Constructor & Destructor Documentation

RSysMonSession()

IMPORT_CRSysMonSession()

Default constructor. Creates an instance of the RSysMonSession class

Member Functions Documentation

CancelAllMonitors()

IMPORT_C TIntCancelAllMonitors()

Used to cancel monitoring of all the components during device shutdown/fail

This function is to be called only by the ssm server. By calling this function early during device shutdown/fail, System Monitor will cancel all the outstanding monitor requests for all the components so that it will not restart them after the application finally exit during the device shutdown.

CancelMonitorSelfL()

IMPORT_C voidCancelMonitorSelfL()

Used to cancel self-monitoring of a component.

This function is to be called by the component being monitored either by calling MonitorL() or MonitorSelfL() function. By calling this function before exiting, System Monitor will cancel the monitor request of the component so that System Monitor will not restart it after it exit.

ChangeToOldStylePropertiesL(const CSsmStartupProperties &)

CStartupProperties *ChangeToOldStylePropertiesL(const CSsmStartupProperties &aSsmStartupProperties)const [private]

Creates old style startup properties from the given CSsmStartupProperties.

Parameters

const CSsmStartupProperties & aSsmStartupPropertiesSsm Startup properties.

Close()

IMPORT_C voidClose()

Closes connection with SysMonServer

DoMonitorL(const CStartupProperties &, const RProcess *, TBool)

voidDoMonitorL(const CStartupProperties &aStartupProperties,
const RProcess *aProcess,
TBoolaExecuteRecoveryMethodOnFailure
)[private]

Parameters

const CStartupProperties & aStartupProperties
const RProcess * aProcess
TBool aExecuteRecoveryMethodOnFailure

MonitorL(const CStartupProperties &, const RProcess &, TBool)

IMPORT_C voidMonitorL(const CStartupProperties &aStartupProperties,
const RProcess &aProcess,
TBoolaExecuteRecoveryMethodOnFailure = EFalse
)
Used to initiate the monitoring of a started component using CStartupProperties. Example use:
	CStartupProperties* prop = CStartupProperties::NewLC(KFilename, KNullDesC);
	prop->SetMonitored(ETrue);
	prop->SetStartupType(EStartApp);
	prop->SetStartMethod(EWaitForStart);
	prop->SetNoOfRetries(1);
	prop->SetTimeout(1000);
	prop->SetRecoveryParams(EIgnoreOnFailure, 0);
	iMySysMonSession.MonitorL(*prop, process);
	CleanupStack::PopAndDestroy(prop);
capability
ECapabilityProtServ
capability
ECapabilityPowerMgmt for ERestartOSWithMode
Instead of this use RSysMonSession::MonitorL(const CSsmStartupProperties& aSsmStartupProperties, const RProcess& aProcess, TBool aExecuteRecoveryMethodOnFailure)
leave
KErrDied if aProcess is no longer running and aExecuteRecoveryMethodOnFailure is false
leave
KErrArgument if aStartupProperties contains invalid argument or if aProcess contain NULL handle
leave
KErrPermissionDenied if client does not have the requied PlatSec capability
leave
KErrAlreadyExists if the process is already registered for monitoring

Parameters

const CStartupProperties & aStartupPropertiesProperties for the component to be monitored. Number of retries and timeout in aStartupProperties should only be used with start-method EWaitForStart or EFireAndForget. Start-method EDeferredWaitForStart can not be used for monitoring.
const RProcess & aProcessThe running instance of the component to be monitored.
TBool aExecuteRecoveryMethodOnFailure = EFalseGives the option to initiate monitoring on an already dead process. If the process is already dead, the monitor will be scheduled to recover the process. The default behaviour is to leave and not allow monitoring to be setup if the process is already dead.

MonitorL(const CSsmStartupProperties &, const RProcess &, TBool)

IMPORT_C voidMonitorL(const CSsmStartupProperties &aSsmStartupProperties,
const RProcess &aProcess,
TBoolaExecuteRecoveryMethodOnFailure = EFalse
)
Used to initiate the monitoring of a started component using CSsmStartupProperties Example use:
	CSsmStartupProperties* prop = CSsmStartupProperties::NewLC(KFilename, KNullDesC);
	prop->SetCommandTypeL(ESsmCmdStartApp);
	prop->SetExecutionBehaviour(ESsmWaitForSignal);	
	prop->SetMonitorInfo(ESsmIgnoreOnFailure, 0, 1000, 1);
	iMySysMonSession.MonitorL(*prop, process);
	CleanupStack::PopAndDestroy(prop);
capability
ECapabilityProtServ
capability
ECapabilityPowerMgmt for ERestartOSWithMode
leave
KErrDied if aProcess is no longer running and aExecuteRecoveryMethodOnFailure is false
leave
KErrArgument if aSsmStartupProperties contains invalid argument or if aProcess contain NULL handle
leave
KErrPermissionDenied if client does not have the requied PlatSec capability
leave
KErrAlreadyExists if the process is already registered for monitoring

Parameters

const CSsmStartupProperties & aSsmStartupPropertiesProperties for the component to be monitored. Number of retries and timeout in aSsmStartupProperties should only be used with start-method ESsmWaitForSignal or ESsmFireAndForget. Start-method ESsmDeferredWaitForSignal can not be used for monitoring.
const RProcess & aProcessThe running instance of the component to be monitored.
TBool aExecuteRecoveryMethodOnFailure = EFalseGives the option to initiate monitoring on an already dead process. If the process is already dead, the monitor will be scheduled to recover the process. The default behaviour is to leave and not allow monitoring to be setup if the process is already dead.

MonitorSelfL(const CStartupProperties &)

IMPORT_C voidMonitorSelfL(const CStartupProperties &aStartupProperties)

Used by a started component to initiate self-monitoring using CStartupProperties.

capability
ECapabilityProtServ for ERestartOS ,ERestartOSWithMode and ECriticalNoRetries
capability
ECapabilityPowerMgmt for ERestartOSWithMode
Instead of this use RSysMonSession::MonitorSelfL(const CSsmStartupProperties& aSsmStartupProperties)
leave
KErrArgument if aStartupProperties contains invalid argument or if aProcess contain NULL handle
leave
KErrPermissionDenied if client does not have the requied PlatSec capability
leave
KErrAlreadyExists if the process is already registered for monitoring

Parameters

const CStartupProperties & aStartupPropertiesProperties for itself. Number of retries and timeout in aStartupProperties should only be used with start-method EWaitForStart or EFireAndForget. Start-method EDeferredWaitForStart can not be used for monitoring.

MonitorSelfL(const CSsmStartupProperties &)

IMPORT_C voidMonitorSelfL(const CSsmStartupProperties &aSsmStartupProperties)

Used by a started component to initiate self-monitoring using CSsmStartupProperties

capability
ECapabilityProtServ for ERestartOS ,ERestartOSWithMode and ECriticalNoRetries
capability
ECapabilityPowerMgmt for ERestartOSWithMode
leave
KErrArgument if aSsmStartupProperties contains invalid argument or if aProcess contain NULL handle
leave
KErrPermissionDenied if client does not have the requied PlatSec capability
leave
KErrAlreadyExists if the process is already registered for monitoring

Parameters

const CSsmStartupProperties & aSsmStartupPropertiesProperties for itself. Number of retries and timeout in aSsmStartupProperties should only be used with start-method ESsmWaitForSignal or ESsmFireAndForget. Start-method ESsmDeferredWaitForSignal can not be used for monitoring.

OpenL()

IMPORT_C voidOpenL()

Opens connection with SysMonServer

Validate(const CStartupProperties &)

TInt Validate(const CStartupProperties &aStartupProperties)[private, static]

Validate CStartupProperties parameter

Parameters

const CStartupProperties & aStartupProperties