rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrserverstartUp.cpp
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:      
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "rtsecmgrserver.h"
       
    24 #include "rtsecmgrserverdef.h"
       
    25 
       
    26 TInt E32Main(); // Process entry point
       
    27 
       
    28 static void RunServerL()
       
    29 	{
       
    30 	// Naming the server process and thread after the startup helps to debug panics
       
    31 	// No error checking as names are not critical for operation
       
    32 	User::RenameProcess (KSecServerProcessName);
       
    33 	User::RenameThread (KSecSrvMainThreadName);
       
    34 
       
    35 	// Set process priority
       
    36 	RProcess svrProcess;
       
    37 	svrProcess.SetPriority (EPriorityHigh);
       
    38 	svrProcess.Close ();
       
    39 
       
    40 	// Create and install the active scheduler we need
       
    41 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
    42 	CleanupStack::PushL (scheduler);
       
    43 
       
    44 	CActiveScheduler::Install ( scheduler);
       
    45 	CRTSecMgrServer* server=  NULL;
       
    46 	server = CRTSecMgrServer::NewLC (CActive::EPriorityStandard);
       
    47 
       
    48 	// Initialisation complete, now signal the client
       
    49 	RProcess::Rendezvous (KErrNone);
       
    50 	CActiveScheduler::Start ();
       
    51 	// Cleanup
       
    52 	CleanupStack::PopAndDestroy (server);
       
    53 	CleanupStack::PopAndDestroy (scheduler);
       
    54 	}
       
    55 
       
    56 /*
       
    57  * Process main function
       
    58  * 
       
    59  */
       
    60 TInt E32Main()
       
    61 	{
       
    62 	__UHEAP_MARK;
       
    63 	TInt i = User::CountAllocCells();
       
    64 	TInt err(KErrNone);
       
    65 
       
    66 	// Start server.
       
    67 	CTrapCleanup* cleanup = CTrapCleanup::New ();
       
    68 	err = KErrNoMemory;
       
    69 
       
    70 	if ( cleanup)
       
    71 		{
       
    72 		TRAP(err, RunServerL());
       
    73 		
       
    74 		delete cleanup;
       
    75 		cleanup = NULL;
       
    76 		}
       
    77 	i = User::CountAllocCells();
       
    78 	__UHEAP_MARKEND;
       
    79 
       
    80 	return err;
       
    81 	}
       
    82 
       
    83 //  End of File  
       
    84