Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "LogServShared.h"
17 #include "LogServServer.h"
18 #include "LogServScheduler.h"
19 #include "logservpanic.h"
21 static void StartLogServerL()
23 // Perform all server initialisation, in particular creation of the
24 // scheduler and server and then run the scheduler
27 #if defined(LOGGING_CREATE_LOG_DIRECTORY) && defined(LOGGING_ENABLED)
29 if (fsSession.Connect() == KErrNone)
31 _LIT(KBaseFolder, "_:\\Logs\\");
32 TFileName path(KBaseFolder);
33 path[0] = 'A' + static_cast<TInt>(RFs::GetSystemDrive());
35 path.Append(KPathDelimiter);
36 fsSession.MkDirAll(path); // ignore error
42 // For !WINS or all EKA2 builds this is needed
43 // Write the process location
44 TFileName processName(RProcess().FileName());
45 LOGTEXT2("StartLogServerL(%S)", &processName);
49 // Naming the server thread after the server helps to debug panics
50 LOGTEXT("StartLogServerL() - about to rename thread");
51 User::LeaveIfError(User::RenameThread(KLogServerName));
53 // Create and install the active scheduler we need
54 CActiveScheduler* scheduler = new(ELeave)CLogActiveScheduler;
55 CleanupStack::PushL(scheduler);
56 CActiveScheduler::Install(scheduler);
58 // create the server (leave it on the cleanup stack)
59 LOGTEXT("StartLogServerL() - about to create server object");
60 CLogServServer::NewLC();
62 // Initialisation complete, now signal the client
63 LOGTEXT("StartLogServerL() - about to signal client thread");
64 RProcess::Rendezvous(KErrNone);
65 // Start the scheduler and wait for clien requests
66 LOGTEXT("StartLogServerL() - about to start scheduler");
67 CActiveScheduler::Start();
69 // Cleanup the server and scheduler
70 LOGTEXT("StartLogServerL() - scheduler stopped, exiting main log engine server thread");
71 CleanupStack::PopAndDestroy(2, scheduler);
76 // Server process entry-point
77 // Recover the startup parameters and run the server
82 CTrapCleanup* cleanup=CTrapCleanup::New();
86 TRAP(r,StartLogServerL());