genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp
branchRCL_3
changeset 25 7701629b34a6
parent 20 a2e897c5c62b
child 33 6896b031c3e1
equal deleted inserted replaced
20:a2e897c5c62b 25:7701629b34a6
   181 		if (err)
   181 		if (err)
   182 			{
   182 			{
   183 			User::Panic(KEstlibInit, err);
   183 			User::Panic(KEstlibInit, err);
   184 			}
   184 			}
   185 
   185 
   186 		iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock, &iTzServer);
   186 		iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock);
   187 		
   187 		
   188 		// No connection settings by default
   188 		// No connection settings by default
   189 		iDefConnPref = NULL;
   189 		iDefConnPref = NULL;
   190 		}
   190 		}
   191 
   191 
   198 	iSessionPathLock.Close();
   198 	iSessionPathLock.Close();
   199 	// Close the aselect lock
   199 	// Close the aselect lock
   200 	iASelectLock.Close();
   200 	iASelectLock.Close();
   201 	// Close the default connection lock
   201 	// Close the default connection lock
   202 	iDefConnLock.Close();
   202 	iDefConnLock.Close();
       
   203 	
   203 	//close the default RConnection
   204 	//close the default RConnection
   204 	if(iDefConnection.SubSessionHandle() != 0)
   205 	if(iDefConnection.SubSessionHandle() != 0)
       
   206 	    {
   205 		iDefConnection.Close();
   207 		iDefConnection.Close();
       
   208 	    }
   206 
   209 
   207 	RHeap* oHeap = User::SwitchHeap(iPrivateHeap);
   210 	RHeap* oHeap = User::SwitchHeap(iPrivateHeap);
   208 	for (TInt i = 0, count = iTLDInfoList.Count(); i < count; i++ )
   211 	for (TInt i = 0, count = iTLDInfoList.Count(); i < count; i++ )
   209 		{
   212 		{
   210 		iTLDInfoList[i].Close(iPrivateHeap);
   213 		iTLDInfoList[i].Close(iPrivateHeap);
   214 	iTLDInfoList.Close();
   217 	iTLDInfoList.Close();
   215 	// Cleanup the threads serving aselect requests
   218 	// Cleanup the threads serving aselect requests
   216 	int err;
   219 	int err;
   217 	// passing 1 to cancelaselect will kill all the threads serving aselect
   220 	// passing 1 to cancelaselect will kill all the threads serving aselect
   218 	cancelaselect(NULL,err,1);
   221 	cancelaselect(NULL,err,1);
   219 	// Switch to backend heap
   222 
   220 	RHeap* oldHeap = User::SwitchHeap(iPrivateHeap);
       
   221 	// Close the array that maintains aselect request details 
   223 	// Close the array that maintains aselect request details 
   222 	iASelectRequest.Close();
   224 	iASelectRequest.Close();
   223 	//close the RTz connection
   225 	//close the RTz connection
   224 	iTzServer.Close();
   226 	iTzServer.Close();
   225 	// Switch back to old heap
   227 
   226 	User::SwitchHeap(oldHeap);
       
   227 
   228 
   228 	if( iDefConnPref )
   229 	if( iDefConnPref )
   229 	    {
   230 	    {
   230 	    switch( iDefConnPref->ExtensionId() )
   231 	    switch( iDefConnPref->ExtensionId() )
   231 	        {
   232 	        {
   232 	        case TConnPref::EConnPrefSnap:
   233 	        case TConnPref::EConnPrefSnap:
   233 	            {
   234 	            {
   234 	            RHeap* oldHeap = User::SwitchHeap(iPrivateHeap);
       
   235 	            delete (TCommSnapPref*)iDefConnPref;
   235 	            delete (TCommSnapPref*)iDefConnPref;
   236 	            // Switch back to old heap
       
   237 	            User::SwitchHeap(oldHeap);
       
   238 	            iDefConnPref = NULL;              
   236 	            iDefConnPref = NULL;              
   239 	            }
   237 	            }
   240 	            break;
   238 	            break;
   241 
   239 
   242 	        case TConnPref::EConnPrefCommDb:
   240 	        case TConnPref::EConnPrefCommDb:
   243 	            {
   241 	            {
   244 	            RHeap* oldHeap = User::SwitchHeap(iPrivateHeap);
       
   245 	            delete (TCommDbConnPref*)iDefConnPref;
   242 	            delete (TCommDbConnPref*)iDefConnPref;
   246 	            // Switch back to old heap
       
   247 	            User::SwitchHeap(oldHeap);
       
   248 	            iDefConnPref = NULL;
   243 	            iDefConnPref = NULL;
   249 	            }
   244 	            }
   250 	            break;              
   245 	            break;              
   251 
   246 
   252 	        default:
   247 	        default:
   255 	            }
   250 	            }
   256 	        }
   251 	        }
   257 	    }
   252 	    }
   258 
   253 
   259 #if (defined SYMBIAN_OE_POSIX_SIGNALS && defined SYMBIAN_OE_LIBRT)
   254 #if (defined SYMBIAN_OE_POSIX_SIGNALS && defined SYMBIAN_OE_LIBRT)
   260 	iTimerOverrunsMutex.Close();
   255 	iTimerOverrunsMutex.Close();	
   261 	iTimerOverruns.Close(); 
   256 	iTimerOverruns.Close(); 
   262 #endif	
   257 #endif	
       
   258 	
       
   259 #if (defined SYMBIAN_OE_POSIX_SIGNALS)
       
   260 	iSigInitWaitMutex.Close();
       
   261 	iSigInitWaitSemaphore.Close();
       
   262 	iBlockedSAMutex.Close();
       
   263 	iSignalWaiterMutex.Close();
       
   264 	iSignalInitSemaphore.Close();
       
   265 #endif
   263 	//close the RpointerArray
   266 	//close the RpointerArray
   264 	iOpenDirList.Close();
   267 	iOpenDirList.Close();
       
   268 	
       
   269 	iSSLock.Close();
       
   270 	iCSLock.Close();
       
   271 	iSignalSession.Close();
       
   272 	iIpcS.Close();
       
   273 		
   265 	User::SwitchHeap(oHeap);
   274 	User::SwitchHeap(oHeap);
   266 	}
   275 	}
   267 
   276 
   268 #ifdef __SYMBIAN_COMPILE_UNUSED__
   277 #ifdef __SYMBIAN_COMPILE_UNUSED__
   269 CLocalSystemInterface& CLocalSystemInterface::Clone()
   278 CLocalSystemInterface& CLocalSystemInterface::Clone()
   332 	{
   341 	{
   333 	return PosixFilesystem::mkdir(iFs, aPath, perms, anErrno);
   342 	return PosixFilesystem::mkdir(iFs, aPath, perms, anErrno);
   334 	}
   343 	}
   335 
   344 
   336 int CLocalSystemInterface::stat (const wchar_t* name, struct stat *st, int& anErrno)
   345 int CLocalSystemInterface::stat (const wchar_t* name, struct stat *st, int& anErrno)
   337     {
   346     {    
   338     const wchar_t* filename;
   347     const wchar_t* filename  = name;
   339     // This needs to be zero terminated
   348     // This needs to be zero terminated
   340     TBuf<KMaxFileName> inputName;
   349     TBuf<KMaxFileName> inputName;
   341     TUint pathAtt = 0;
   350     TUint pathAtt = 0;
   342     TInt err = GetFullFile(inputName,(const TText16*)name,iFs);
   351     TInt err = GetFullFile(inputName,(const TText16*)name,iFs);
   343     if( !err )
   352     if( !err )
   345         TInt err = iFs.Att(inputName,pathAtt);
   354         TInt err = iFs.Att(inputName,pathAtt);
   346         if ( (err == KErrNone) && (pathAtt & KEntryAttDir) )
   355         if ( (err == KErrNone) && (pathAtt & KEntryAttDir) )
   347             {                    
   356             {                    
   348             inputName.Append(_L("\\"));            
   357             inputName.Append(_L("\\"));            
   349             }
   358             }
   350         filename = (wchar_t*)inputName.PtrZ();
       
   351         }
       
   352     // try to stat anyway
       
   353     else
       
   354         {
       
   355         inputName.Copy((const TText16*)name);
       
   356         filename = (wchar_t*)inputName.PtrZ();
   359         filename = (wchar_t*)inputName.PtrZ();
   357         }
   360         }
   358     TSpecialFileType fileType;
   361     TSpecialFileType fileType;
   359     struct SLinkInfo enBuf;
   362     struct SLinkInfo enBuf;
   360     // Check the type of file
   363     // Check the type of file