1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogServ/src/LogServStartup.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,94 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "LogServShared.h"
1.20 +#include "LogServServer.h"
1.21 +#include "LogServScheduler.h"
1.22 +#include "logservpanic.h"
1.23 +
1.24 +static void StartLogServerL()
1.25 +//
1.26 +// Perform all server initialisation, in particular creation of the
1.27 +// scheduler and server and then run the scheduler
1.28 +//
1.29 + {
1.30 +#if defined(LOGGING_CREATE_LOG_DIRECTORY) && defined(LOGGING_ENABLED)
1.31 + RFs fsSession;
1.32 + if (fsSession.Connect() == KErrNone)
1.33 + {
1.34 + _LIT(KBaseFolder, "_:\\Logs\\");
1.35 + TFileName path(KBaseFolder);
1.36 + path[0] = 'A' + static_cast<TInt>(RFs::GetSystemDrive());
1.37 + path += KLogFolder;
1.38 + path.Append(KPathDelimiter);
1.39 + fsSession.MkDirAll(path); // ignore error
1.40 + }
1.41 + fsSession.Close();
1.42 +
1.43 + //LOGNEW;
1.44 +
1.45 + // For !WINS or all EKA2 builds this is needed
1.46 + // Write the process location
1.47 + TFileName processName(RProcess().FileName());
1.48 + LOGTEXT2("StartLogServerL(%S)", &processName);
1.49 +
1.50 +#endif
1.51 +
1.52 + // Naming the server thread after the server helps to debug panics
1.53 + LOGTEXT("StartLogServerL() - about to rename thread");
1.54 + User::LeaveIfError(User::RenameThread(KLogServerName));
1.55 +
1.56 + // Create and install the active scheduler we need
1.57 + CActiveScheduler* scheduler = new(ELeave)CLogActiveScheduler;
1.58 + CleanupStack::PushL(scheduler);
1.59 + CActiveScheduler::Install(scheduler);
1.60 +
1.61 + // create the server (leave it on the cleanup stack)
1.62 + LOGTEXT("StartLogServerL() - about to create server object");
1.63 + CLogServServer::NewLC();
1.64 +
1.65 + // Initialisation complete, now signal the client
1.66 + LOGTEXT("StartLogServerL() - about to signal client thread");
1.67 + RProcess::Rendezvous(KErrNone);
1.68 + // Start the scheduler and wait for clien requests
1.69 + LOGTEXT("StartLogServerL() - about to start scheduler");
1.70 + CActiveScheduler::Start();
1.71 +
1.72 + // Cleanup the server and scheduler
1.73 + LOGTEXT("StartLogServerL() - scheduler stopped, exiting main log engine server thread");
1.74 + CleanupStack::PopAndDestroy(2, scheduler);
1.75 + }
1.76 +
1.77 +TInt E32Main()
1.78 +//
1.79 +// Server process entry-point
1.80 +// Recover the startup parameters and run the server
1.81 +//
1.82 + {
1.83 + __UHEAP_MARK;
1.84 + //
1.85 + CTrapCleanup* cleanup=CTrapCleanup::New();
1.86 + TInt r=KErrNoMemory;
1.87 + if (cleanup)
1.88 + {
1.89 + TRAP(r,StartLogServerL());
1.90 + delete cleanup;
1.91 + }
1.92 + //
1.93 + __UHEAP_MARKEND;
1.94 + return r;
1.95 + }
1.96 +
1.97 +