294 // ----------------------------------------------------------------------------- |
296 // ----------------------------------------------------------------------------- |
295 // |
297 // |
296 void CLocalSystemInterface::Exit(int code) |
298 void CLocalSystemInterface::Exit(int code) |
297 { |
299 { |
298 #ifdef SYMBIAN_OE_POSIX_SIGNALS |
300 #ifdef SYMBIAN_OE_POSIX_SIGNALS |
|
301 TRequestStatus status = KRequestPending; |
|
302 iSignalHandlerThread.Logon(status); |
299 iSignalLoopRunning = EFalse; |
303 iSignalLoopRunning = EFalse; |
|
304 iSignalHandlerThread.RequestSignal(); |
|
305 User::WaitForRequest(status); |
300 #endif |
306 #endif |
301 |
|
302 iFids.Close(); |
307 iFids.Close(); |
303 User::SetCritical(User::EProcessPermanent); |
308 User::SetCritical(User::EProcessPermanent); |
304 User::Exit(code); |
309 User::Exit(code); |
305 } |
310 } |
306 |
311 |
325 { |
330 { |
326 return PosixFilesystem::mkdir(iFs, aPath, perms, anErrno); |
331 return PosixFilesystem::mkdir(iFs, aPath, perms, anErrno); |
327 } |
332 } |
328 |
333 |
329 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) |
330 { |
335 { |
331 return PosixFilesystem::stat(iFs, name, st, anErrno); |
336 const wchar_t* filename = name; |
332 } |
337 TSpecialFileType fileType; |
|
338 struct SLinkInfo enBuf; |
|
339 TInt err = 0; |
|
340 // Check the type of file |
|
341 fileType = _SystemSpecialFileBasedFilePath(name, err, iFs); |
|
342 // If it is a symbolic link, follow the link |
|
343 // If _SystemSpecialFileBasedFilePath fails, treat it as normal file |
|
344 // and try to proceed |
|
345 if( fileType == EFileTypeSymLink && err == KErrNone ) |
|
346 { |
|
347 err = _ReadSysSplFile(name, (char*)&enBuf, sizeof(struct SLinkInfo), anErrno, iFs); |
|
348 if (err == KErrNone) |
|
349 { |
|
350 filename = (wchar_t*)enBuf.iParentPath; |
|
351 } |
|
352 else |
|
353 { |
|
354 return -1; |
|
355 } |
|
356 } |
|
357 else if ( fileType != EFileGeneralError && err != KErrNone ) |
|
358 { |
|
359 return MapError(err,anErrno); |
|
360 } |
|
361 return PosixFilesystem::statbackend(iFs, filename, st, anErrno); |
|
362 } |
|
363 |
|
364 int CLocalSystemInterface::lstat (const wchar_t* name, struct stat *st, int& anErrno) |
|
365 { |
|
366 return PosixFilesystem::statbackend(iFs, name, st, anErrno); |
|
367 } |
333 |
368 |
334 int CLocalSystemInterface::utime (const wchar_t* name, const struct utimbuf *filetimes, int& anErrno) |
369 int CLocalSystemInterface::utime (const wchar_t* name, const struct utimbuf *filetimes, int& anErrno) |
335 { |
370 { |
336 return PosixFilesystem::utime(iFs, name, filetimes, anErrno); |
371 return PosixFilesystem::utime(iFs, name, filetimes, anErrno); |
337 } |
372 } |
538 if(lRetVal != KErrNone) |
573 if(lRetVal != KErrNone) |
539 { |
574 { |
540 iSignalInitSemaphore.Signal(); |
575 iSignalInitSemaphore.Signal(); |
541 return lRetVal; |
576 return lRetVal; |
542 } |
577 } |
543 |
578 |
|
579 /* Closing the end of the pipe that's been sent to the server */ |
|
580 iSignalWritePipe.Close(); |
|
581 |
544 iSignalsInitialized = ETrue; |
582 iSignalsInitialized = ETrue; |
545 iSignalInitSemaphore.Signal(); |
583 iSignalInitSemaphore.Signal(); |
546 iSignalLoopRunning = ETrue; |
584 iSignalLoopRunning = ETrue; |
547 iPipeReadStatus = KRequestPending; |
585 iPipeReadStatus = KRequestPending; |
548 iSignalReadPipe.NotifyDataAvailable(iPipeReadStatus); |
586 iSignalReadPipe.NotifyDataAvailable(iPipeReadStatus); |
549 while(iSignalLoopRunning) |
587 while(iSignalLoopRunning) |
550 { |
588 { |
551 User::WaitForAnyRequest(); |
589 User::WaitForAnyRequest(); |
|
590 if(iSignalLoopRunning == false) { |
|
591 break; |
|
592 } |
552 // Check if it is a pipe read |
593 // Check if it is a pipe read |
553 if(iPipeReadStatus != KRequestPending) |
594 if(iPipeReadStatus != KRequestPending) |
554 { |
595 { |
555 if(iPipeReadStatus == KErrNone) |
596 if(iPipeReadStatus == KErrNone) |
556 { |
597 { |
705 } |
746 } |
706 if(iPipeReadStatus == KRequestPending) |
747 if(iPipeReadStatus == KRequestPending) |
707 { |
748 { |
708 iSignalReadPipe.CancelDataAvailable(); |
749 iSignalReadPipe.CancelDataAvailable(); |
709 } |
750 } |
|
751 iSignalReadPipe.Close(); |
|
752 |
710 if(iAlarmStatus == KRequestPending) |
753 if(iAlarmStatus == KRequestPending) |
711 { |
754 { |
712 iAlarmTimer.Cancel(); |
755 iAlarmTimer.Cancel(); |
713 } |
756 } |
714 TInt lCounterIdx = 0; |
757 TInt lCounterIdx = 0; |