Add a prelimary fix in SM_Heap_Lock() about new segments mapping in System Heap,

Warning: This is broken and needs debugging...
This commit is contained in:
agibert 2005-06-26 23:40:14 +00:00
parent 7fb191ce32
commit 998062740e

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libshmem.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.3 $ */
/* $Revision: 2.4 $ */
/* $Name: $ */
/* $Date: 2005/06/26 22:50:49 $ */
/* $Date: 2005/06/26 23:40:14 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@ -36,7 +36,7 @@
#include <libshmem.h>
#ifdef _LIBVER_SUPPORT
VER_INFO_EXPORT(libshmem,"$Revision: 2.3 $", "$Name: $",__FILE__,"$Author: agibert $")
VER_INFO_EXPORT(libshmem,"$Revision: 2.4 $", "$Name: $",__FILE__,"$Author: agibert $")
#endif
/*------------------------------------------------------------------------------*/
@ -650,7 +650,7 @@ SMT_Status SM_Heap_Open_I( const char *Heap_Name, SMT_Heap **Heap, size_t Se
rc = ND_Value_Alloc( SM_Base->MHR, (void **)&MHH, Prefixed_Name, Seg_Size);
if( rc != NDS_OK)
{
sprintf( SM_Error_Msg, "SM_Heap_Open : unable to to create the MHR structure");
sprintf( SM_Error_Msg, "SM_Heap_Open : unable to alloc a new MHH structure");
SM_Error_Print();
return(SMS_ERRAPI);
}
@ -934,6 +934,9 @@ SMT_Status SM_Heap_Lock_I ( SMT_Heap * Heap, SMT_Flags Lock_Mode, int * Locked )
{
/* Rien à faire : le heap est déjà verrouillé dans ce mode */
fprintf( stderr, "Already locked !!!\n");
fflush( stderr);
*Locked = FALSE;
}
else if( Heap->Lock_Mode == SMD_NO_LOCK)
@ -1013,6 +1016,52 @@ SMT_Status SM_Heap_Lock_I ( SMT_Heap * Heap, SMT_Flags Lock_Mode, int * Locked )
}
}
/* TEST !!!! */
{
NDT_Node *node_ptr = NULL;
SMT_Heap *heap_ptr;
if( SM_Heap_IsOpen_I( "system", &heap_ptr) != SMS_OK)
{
sprintf (SM_Error_Msg, "SM_Heap_Lock : Internal Error 1 !");
SM_Error_Print ();
}
else
{
if( Heap->Nb_Seg != Heap->MHH->DSR->Index_Tab[NDD_INDEX_PRIMARY].Node_Number)
{
ND_Index_Node_First_Get( &node_ptr, Heap->MHH->DSR, NDD_INDEX_PRIMARY);
if( node_ptr == NULL)
{
sprintf (SM_Error_Msg, "SM_Heap_Lock : Internal Error 2 !");
SM_Error_Print ();
}
else
{
while( node_ptr)
{
if( ( rc = SM_DataSegment_Open( node_ptr->Value)) != SMS_OK)
{
sprintf (SM_Error_Msg, "SM_Heap_Lock : unable to open one of the data segments of heap \"%s\"",
( (SMT_MHH *)(node_ptr->Value))->Name);
SM_Error_Print ();
}
else
{
// sprintf (SM_Error_Msg, "SM_Heap_Lock : Opening Segment (%x)", node_ptr->Value);
// SM_Error_Print ();
}
ND_Index_Node_Next_Get( &node_ptr, node_ptr);
}
}
}
}
}
/* On vérifie qu'aucun nouveau segment n'a été ajouté depuis la dernière ouverture */
if (Heap->Nb_Seg != Heap->MHH->DSR->Index_Tab[NDD_INDEX_PRIMARY].Node_Number)
@ -3086,7 +3135,7 @@ NDT_Status SM_Opened_Heap_List_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Inde
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.3 $ $Name: $ $Date: 2005/06/26 22:50:49 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.4 $ $Name: $ $Date: 2005/06/26 23:40:14 $ $Author: agibert $";
return( NDS_OK);
}
@ -3313,7 +3362,7 @@ NDT_Status MHR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.3 $ $Name: $ $Date: 2005/06/26 22:50:49 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.4 $ $Name: $ $Date: 2005/06/26 23:40:14 $ $Author: agibert $";
return( NDS_OK);
}
@ -3818,6 +3867,15 @@ NDT_Status MHR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
return( status);
}
/* TEST !!! */
if( locked != TRUE)
{
sprintf( SM_Error_Msg, "Error MHR_Manager : unable to lock Heap_Name: [%s] for reading", MHH_Ptr->Name);
SM_Error_Print();
return( SMS_KO);
}
segment_nb = MHH_Ptr->DSR->Index_Tab[NDD_INDEX_PRIMARY].Node_Number;
ND_DataStruct_Traverse( MHH_Ptr->DSR, NDD_CMD_VALUE_SUM, (void *)&segment_size);
@ -4058,7 +4116,7 @@ NDT_Status SM_DSR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.3 $ $Name: $ $Date: 2005/06/26 22:50:49 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.4 $ $Name: $ $Date: 2005/06/26 23:40:14 $ $Author: agibert $";
return( NDS_OK);
}
@ -4590,7 +4648,7 @@ NDT_Status SM_ACR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.3 $ $Name: $ $Date: 2005/06/26 22:50:49 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.4 $ $Name: $ $Date: 2005/06/26 23:40:14 $ $Author: agibert $";
return( NDS_OK);
}
@ -4846,7 +4904,7 @@ NDT_Status SM_FCR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.3 $ $Name: $ $Date: 2005/06/26 22:50:49 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.4 $ $Name: $ $Date: 2005/06/26 23:40:14 $ $Author: agibert $";
return( NDS_OK);
}