163 err |= iASelectLock.CreateLocal(); |
165 err |= iASelectLock.CreateLocal(); |
164 //Protect the iDefConnection from concurrent GetDefaultConnection calls |
166 //Protect the iDefConnection from concurrent GetDefaultConnection calls |
165 err |= iDefConnLock.CreateLocal(); |
167 err |= iDefConnLock.CreateLocal(); |
166 } |
168 } |
167 |
169 |
|
170 if(err == KErrNone) |
|
171 { |
|
172 err = iTzServer.Connect(); |
|
173 if(!err) |
|
174 { |
|
175 err = iTzServer.ShareAuto(); |
|
176 } |
|
177 } |
|
178 |
|
179 |
168 //Panic if any of the above operation returns with error |
180 //Panic if any of the above operation returns with error |
169 if (err) |
181 if (err) |
170 { |
182 { |
171 User::Panic(KEstlibInit, err); |
183 User::Panic(KEstlibInit, err); |
172 } |
184 } |
173 |
185 |
174 iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock); |
186 iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock, &iTzServer); |
175 |
187 |
176 // No connection settings by default |
188 // No connection settings by default |
177 iDefConnPref = NULL; |
189 iDefConnPref = NULL; |
178 } |
190 } |
179 |
191 |
284 // ----------------------------------------------------------------------------- |
296 // ----------------------------------------------------------------------------- |
285 // |
297 // |
286 void CLocalSystemInterface::Exit(int code) |
298 void CLocalSystemInterface::Exit(int code) |
287 { |
299 { |
288 #ifdef SYMBIAN_OE_POSIX_SIGNALS |
300 #ifdef SYMBIAN_OE_POSIX_SIGNALS |
|
301 TRequestStatus status = KRequestPending; |
|
302 iSignalHandlerThread.Logon(status); |
289 iSignalLoopRunning = EFalse; |
303 iSignalLoopRunning = EFalse; |
|
304 iSignalHandlerThread.RequestSignal(); |
|
305 User::WaitForRequest(status); |
290 #endif |
306 #endif |
291 |
|
292 iFids.Close(); |
307 iFids.Close(); |
293 User::SetCritical(User::EProcessPermanent); |
308 User::SetCritical(User::EProcessPermanent); |
294 User::Exit(code); |
309 User::Exit(code); |
295 } |
310 } |
296 |
311 |
315 { |
330 { |
316 return PosixFilesystem::mkdir(iFs, aPath, perms, anErrno); |
331 return PosixFilesystem::mkdir(iFs, aPath, perms, anErrno); |
317 } |
332 } |
318 |
333 |
319 int CLocalSystemInterface::stat (const wchar_t* name, struct stat *st, int& anErrno) |
334 int CLocalSystemInterface::stat (const wchar_t* name, struct stat *st, int& anErrno) |
320 { |
335 { |
321 return PosixFilesystem::stat(iFs, name, st, anErrno); |
336 const wchar_t* filename; |
322 } |
337 // This needs to be zero terminated |
|
338 TBuf<KMaxFileName> inputName; |
|
339 TUint pathAtt = 0; |
|
340 TInt err = GetFullFile(inputName,(const TText16*)name,iFs); |
|
341 if( !err ) |
|
342 { |
|
343 TInt err = iFs.Att(inputName,pathAtt); |
|
344 if ( (err == KErrNone) && (pathAtt & KEntryAttDir) ) |
|
345 { |
|
346 inputName.Append(_L("\\")); |
|
347 } |
|
348 filename = (wchar_t*)inputName.PtrZ(); |
|
349 } |
|
350 // try to stat anyway |
|
351 else |
|
352 { |
|
353 inputName.Copy((const TText16*)name); |
|
354 filename = (wchar_t*)inputName.PtrZ(); |
|
355 } |
|
356 TSpecialFileType fileType; |
|
357 struct SLinkInfo enBuf; |
|
358 // Check the type of file |
|
359 fileType = _SystemSpecialFileBasedFilePath(filename, err, iFs); |
|
360 // If it is a symbolic link, follow the link |
|
361 // If _SystemSpecialFileBasedFilePath fails, treat it as normal file |
|
362 // and try to proceed |
|
363 if( fileType == EFileTypeSymLink && err == KErrNone ) |
|
364 { |
|
365 err = _ReadSysSplFile(filename, (char*)&enBuf, sizeof(struct SLinkInfo), anErrno, iFs); |
|
366 if (err == KErrNone) |
|
367 { |
|
368 filename = (wchar_t*)enBuf.iParentPath; |
|
369 } |
|
370 else |
|
371 { |
|
372 // errno is already set by _ReadSysSplFile |
|
373 return -1; |
|
374 } |
|
375 } |
|
376 else if ( fileType != EFileGeneralError && err != KErrNone ) |
|
377 { |
|
378 return MapError(err,anErrno); |
|
379 } |
|
380 return PosixFilesystem::statbackend(iFs, filename, st, anErrno); |
|
381 } |
|
382 |
|
383 int CLocalSystemInterface::lstat (const wchar_t* name, struct stat *st, int& anErrno) |
|
384 { |
|
385 return PosixFilesystem::statbackend(iFs, name, st, anErrno); |
|
386 } |
323 |
387 |
324 int CLocalSystemInterface::utime (const wchar_t* name, const struct utimbuf *filetimes, int& anErrno) |
388 int CLocalSystemInterface::utime (const wchar_t* name, const struct utimbuf *filetimes, int& anErrno) |
325 { |
389 { |
326 return PosixFilesystem::utime(iFs, name, filetimes, anErrno); |
390 return PosixFilesystem::utime(iFs, name, filetimes, anErrno); |
327 } |
391 } |
528 if(lRetVal != KErrNone) |
592 if(lRetVal != KErrNone) |
529 { |
593 { |
530 iSignalInitSemaphore.Signal(); |
594 iSignalInitSemaphore.Signal(); |
531 return lRetVal; |
595 return lRetVal; |
532 } |
596 } |
533 |
597 |
|
598 /* Closing the end of the pipe that's been sent to the server */ |
|
599 iSignalWritePipe.Close(); |
|
600 |
534 iSignalsInitialized = ETrue; |
601 iSignalsInitialized = ETrue; |
535 iSignalInitSemaphore.Signal(); |
602 iSignalInitSemaphore.Signal(); |
536 iSignalLoopRunning = ETrue; |
603 iSignalLoopRunning = ETrue; |
537 iPipeReadStatus = KRequestPending; |
604 iPipeReadStatus = KRequestPending; |
538 iSignalReadPipe.NotifyDataAvailable(iPipeReadStatus); |
605 iSignalReadPipe.NotifyDataAvailable(iPipeReadStatus); |
539 while(iSignalLoopRunning) |
606 while(iSignalLoopRunning) |
540 { |
607 { |
541 User::WaitForAnyRequest(); |
608 User::WaitForAnyRequest(); |
|
609 if(iSignalLoopRunning == false) { |
|
610 break; |
|
611 } |
542 // Check if it is a pipe read |
612 // Check if it is a pipe read |
543 if(iPipeReadStatus != KRequestPending) |
613 if(iPipeReadStatus != KRequestPending) |
544 { |
614 { |
545 if(iPipeReadStatus == KErrNone) |
615 if(iPipeReadStatus == KErrNone) |
546 { |
616 { |