sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "LogServShared.h"
|
sl@0
|
17 |
#include "LogServServer.h"
|
sl@0
|
18 |
#include "LogServScheduler.h"
|
sl@0
|
19 |
#include "logservpanic.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
static void StartLogServerL()
|
sl@0
|
22 |
//
|
sl@0
|
23 |
// Perform all server initialisation, in particular creation of the
|
sl@0
|
24 |
// scheduler and server and then run the scheduler
|
sl@0
|
25 |
//
|
sl@0
|
26 |
{
|
sl@0
|
27 |
#if defined(LOGGING_CREATE_LOG_DIRECTORY) && defined(LOGGING_ENABLED)
|
sl@0
|
28 |
RFs fsSession;
|
sl@0
|
29 |
if (fsSession.Connect() == KErrNone)
|
sl@0
|
30 |
{
|
sl@0
|
31 |
_LIT(KBaseFolder, "_:\\Logs\\");
|
sl@0
|
32 |
TFileName path(KBaseFolder);
|
sl@0
|
33 |
path[0] = 'A' + static_cast<TInt>(RFs::GetSystemDrive());
|
sl@0
|
34 |
path += KLogFolder;
|
sl@0
|
35 |
path.Append(KPathDelimiter);
|
sl@0
|
36 |
fsSession.MkDirAll(path); // ignore error
|
sl@0
|
37 |
}
|
sl@0
|
38 |
fsSession.Close();
|
sl@0
|
39 |
|
sl@0
|
40 |
//LOGNEW;
|
sl@0
|
41 |
|
sl@0
|
42 |
// For !WINS or all EKA2 builds this is needed
|
sl@0
|
43 |
// Write the process location
|
sl@0
|
44 |
TFileName processName(RProcess().FileName());
|
sl@0
|
45 |
LOGTEXT2("StartLogServerL(%S)", &processName);
|
sl@0
|
46 |
|
sl@0
|
47 |
#endif
|
sl@0
|
48 |
|
sl@0
|
49 |
// Naming the server thread after the server helps to debug panics
|
sl@0
|
50 |
LOGTEXT("StartLogServerL() - about to rename thread");
|
sl@0
|
51 |
User::LeaveIfError(User::RenameThread(KLogServerName));
|
sl@0
|
52 |
|
sl@0
|
53 |
// Create and install the active scheduler we need
|
sl@0
|
54 |
CActiveScheduler* scheduler = new(ELeave)CLogActiveScheduler;
|
sl@0
|
55 |
CleanupStack::PushL(scheduler);
|
sl@0
|
56 |
CActiveScheduler::Install(scheduler);
|
sl@0
|
57 |
|
sl@0
|
58 |
// create the server (leave it on the cleanup stack)
|
sl@0
|
59 |
LOGTEXT("StartLogServerL() - about to create server object");
|
sl@0
|
60 |
CLogServServer::NewLC();
|
sl@0
|
61 |
|
sl@0
|
62 |
// Initialisation complete, now signal the client
|
sl@0
|
63 |
LOGTEXT("StartLogServerL() - about to signal client thread");
|
sl@0
|
64 |
RProcess::Rendezvous(KErrNone);
|
sl@0
|
65 |
// Start the scheduler and wait for clien requests
|
sl@0
|
66 |
LOGTEXT("StartLogServerL() - about to start scheduler");
|
sl@0
|
67 |
CActiveScheduler::Start();
|
sl@0
|
68 |
|
sl@0
|
69 |
// Cleanup the server and scheduler
|
sl@0
|
70 |
LOGTEXT("StartLogServerL() - scheduler stopped, exiting main log engine server thread");
|
sl@0
|
71 |
CleanupStack::PopAndDestroy(2, scheduler);
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
TInt E32Main()
|
sl@0
|
75 |
//
|
sl@0
|
76 |
// Server process entry-point
|
sl@0
|
77 |
// Recover the startup parameters and run the server
|
sl@0
|
78 |
//
|
sl@0
|
79 |
{
|
sl@0
|
80 |
__UHEAP_MARK;
|
sl@0
|
81 |
//
|
sl@0
|
82 |
CTrapCleanup* cleanup=CTrapCleanup::New();
|
sl@0
|
83 |
TInt r=KErrNoMemory;
|
sl@0
|
84 |
if (cleanup)
|
sl@0
|
85 |
{
|
sl@0
|
86 |
TRAP(r,StartLogServerL());
|
sl@0
|
87 |
delete cleanup;
|
sl@0
|
88 |
}
|
sl@0
|
89 |
//
|
sl@0
|
90 |
__UHEAP_MARKEND;
|
sl@0
|
91 |
return r;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
|