Implement signal support for Windows target,
Fix NDT_Root header for HP compilation: Index default number goes from 0 to 1.
This commit is contained in:
parent
c70c4e5aba
commit
7c96ad706b
@ -1,9 +1,9 @@
|
|||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* $RCSfile: node.h,v $ */
|
/* $RCSfile: node.h,v $ */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* $Revision: 2.8 $ */
|
/* $Revision: 2.9 $ */
|
||||||
/* $Name: $ */
|
/* $Name: $ */
|
||||||
/* $Date: 2004/08/02 21:26:03 $ */
|
/* $Date: 2004/08/23 22:47:22 $ */
|
||||||
/* $Author: agibert $ */
|
/* $Author: agibert $ */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ typedef struct NDT_Root
|
|||||||
|
|
||||||
NDT_Index_Nb Index_Nb;
|
NDT_Index_Nb Index_Nb;
|
||||||
NDT_Index_Nb Index_Open_Count;
|
NDT_Index_Nb Index_Open_Count;
|
||||||
NDT_Index Index_Tab[0];
|
NDT_Index Index_Tab[1];
|
||||||
|
|
||||||
} NDT_Root;
|
} NDT_Root;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* $RCSfile: libnode.c,v $ */
|
/* $RCSfile: libnode.c,v $ */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* $Revision: 2.11 $ */
|
/* $Revision: 2.12 $ */
|
||||||
/* $Name: $ */
|
/* $Name: $ */
|
||||||
/* $Date: 2004/08/02 21:26:03 $ */
|
/* $Date: 2004/08/23 22:47:22 $ */
|
||||||
/* $Author: agibert $ */
|
/* $Author: agibert $ */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -34,7 +34,7 @@
|
|||||||
#include <libnode.h>
|
#include <libnode.h>
|
||||||
|
|
||||||
#ifdef _LIBVER_SUPPORT
|
#ifdef _LIBVER_SUPPORT
|
||||||
VER_INFO_EXPORT( libnode, "$Revision: 2.11 $", "$Name: $", __FILE__, "$Author: agibert $")
|
VER_INFO_EXPORT( libnode, "$Revision: 2.12 $", "$Name: $", __FILE__, "$Author: agibert $")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ NDT_Status ND_Default_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT
|
|||||||
|
|
||||||
Command_Name = "NDD_CMD_MANAGER_VERSION";
|
Command_Name = "NDD_CMD_MANAGER_VERSION";
|
||||||
|
|
||||||
*Version_Name_Ptr = "$Revision: 2.11 $ $Name: $ $Date: 2004/08/02 21:26:03 $ $Author: agibert $";
|
*Version_Name_Ptr = "$Revision: 2.12 $ $Name: $ $Date: 2004/08/23 22:47:22 $ $Author: agibert $";
|
||||||
|
|
||||||
return( NDS_OK);
|
return( NDS_OK);
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ NDT_Status ND_OpenStruct_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id,
|
|||||||
|
|
||||||
Command_Name = "NDD_CMD_MANAGER_VERSION";
|
Command_Name = "NDD_CMD_MANAGER_VERSION";
|
||||||
|
|
||||||
*Version_Name_Ptr = "$Revision: 2.11 $ $Name: $ $Date: 2004/08/02 21:26:03 $ $Author: agibert $";
|
*Version_Name_Ptr = "$Revision: 2.12 $ $Name: $ $Date: 2004/08/23 22:47:22 $ $Author: agibert $";
|
||||||
|
|
||||||
return( NDS_OK);
|
return( NDS_OK);
|
||||||
}
|
}
|
||||||
@ -702,12 +702,12 @@ NDT_Status ND_Library_Close_C( void)
|
|||||||
{
|
{
|
||||||
if( NDG_Base.OpenStruct_Ptr->Index_Tab[NDD_INDEX_PRIMARY].Node_Number > 0)
|
if( NDG_Base.OpenStruct_Ptr->Index_Tab[NDD_INDEX_PRIMARY].Node_Number > 0)
|
||||||
{
|
{
|
||||||
sprintf( NDG_Base.Err_String, "Error ND_Library_Open_C: Unclosed DataStruct:");
|
sprintf( NDG_Base.Err_String, "Error ND_Library_Close_C: Unclosed DataStruct:");
|
||||||
ND_Error_Print();
|
ND_Error_Print();
|
||||||
|
|
||||||
if( ( status = ND_DataStruct_Info_Print_I( NDG_Base.Err_Stream, NDG_Base.OpenStruct_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 0, 0)) != NDS_OK)
|
if( ( status = ND_DataStruct_Info_Print_I( NDG_Base.Err_Stream, NDG_Base.OpenStruct_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 0, 0)) != NDS_OK)
|
||||||
{
|
{
|
||||||
sprintf( NDG_Base.Err_String, "Error ND_Library_Open_C: can't print OpenStruct info");
|
sprintf( NDG_Base.Err_String, "Error ND_Library_Close_C: can't print OpenStruct info");
|
||||||
ND_Error_Print();
|
ND_Error_Print();
|
||||||
|
|
||||||
return( NDS_KO);
|
return( NDS_KO);
|
||||||
@ -716,7 +716,7 @@ NDT_Status ND_Library_Close_C( void)
|
|||||||
|
|
||||||
if( ( status = ND_DataStruct_Close_I( NDG_Base.OpenStruct_Ptr)) != NDS_OK)
|
if( ( status = ND_DataStruct_Close_I( NDG_Base.OpenStruct_Ptr)) != NDS_OK)
|
||||||
{
|
{
|
||||||
sprintf( NDG_Base.Err_String, "Error ND_Library_Open_C: can't close OpenStruct");
|
sprintf( NDG_Base.Err_String, "Error ND_Library_Close_C: can't close OpenStruct");
|
||||||
ND_Error_Print();
|
ND_Error_Print();
|
||||||
|
|
||||||
return( NDS_KO);
|
return( NDS_KO);
|
||||||
@ -4208,7 +4208,7 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **Root_Ptr_Ptr, NDT_Index_Nb Index_Nb,
|
|||||||
NDT_Index_Id index_id;
|
NDT_Index_Id index_id;
|
||||||
|
|
||||||
|
|
||||||
status = ND_Allocator_Exec_I( Allocator_Ptr, (void **)Root_Ptr_Ptr, ( sizeof( NDT_Root) + sizeof(NDT_Index) * (Index_Nb + 1)), Data_Ptr);
|
status = ND_Allocator_Exec_I( Allocator_Ptr, (void **)Root_Ptr_Ptr, ( sizeof( NDT_Root) + sizeof(NDT_Index) * (Index_Nb - 1)), Data_Ptr);
|
||||||
if( ND_ERROR(status)) return( status);
|
if( ND_ERROR(status)) return( status);
|
||||||
|
|
||||||
if( strlen(Manager_Name) > NDD_MANAGER_NAME_LEN_MAX) return( NDS_ERRAPI);
|
if( strlen(Manager_Name) > NDD_MANAGER_NAME_LEN_MAX) return( NDS_ERRAPI);
|
||||||
@ -5560,7 +5560,7 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
|
|||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
/* Vérifie qu'une adresse est valide */
|
/* Target address access try */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status ND_Address_Check( void *Address)
|
NDT_Status ND_Address_Check( void *Address)
|
||||||
@ -5569,15 +5569,9 @@ NDT_Status ND_Address_Check( void *Address)
|
|||||||
NDT_Status status;
|
NDT_Status status;
|
||||||
int rc;
|
int rc;
|
||||||
int test;
|
int test;
|
||||||
struct sigaction act =
|
struct sigaction act = {0}, oact_bus, oact_segv;
|
||||||
{
|
|
||||||
ND_Signal_Trap, //
|
|
||||||
0, //
|
|
||||||
0, // sa_mask
|
|
||||||
0, // sa_flags
|
|
||||||
0 //
|
|
||||||
}, oact_bus, oact_segv;
|
|
||||||
|
|
||||||
|
act.sa_handler = ND_Signal_Trap;
|
||||||
|
|
||||||
NDG_Base.Sig_Trapped = 0;
|
NDG_Base.Sig_Trapped = 0;
|
||||||
|
|
||||||
@ -5603,7 +5597,7 @@ NDT_Status ND_Address_Check( void *Address)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* On tente d'accéder à l'adresse fournie */
|
/* Target address access try */
|
||||||
|
|
||||||
if( sigsetjmp( NDG_Base.SigLongJmp_Env, 1) == 0 )
|
if( sigsetjmp( NDG_Base.SigLongJmp_Env, 1) == 0 )
|
||||||
{
|
{
|
||||||
@ -5638,7 +5632,53 @@ NDT_Status ND_Address_Check( void *Address)
|
|||||||
|
|
||||||
return( status);
|
return( status);
|
||||||
#else
|
#else
|
||||||
return( NDS_OK);
|
NDT_Status status;
|
||||||
|
int test;
|
||||||
|
void (__cdecl *old_sigsegv_sighandler)(int);
|
||||||
|
|
||||||
|
|
||||||
|
NDG_Base.Sig_Trapped = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Trap SIGSEGV */
|
||||||
|
|
||||||
|
if( ( old_sigsegv_sighandler = signal( SIGSEGV, ND_Signal_Trap)) == SIG_ERR)
|
||||||
|
{
|
||||||
|
sprintf( NDG_Base.Err_String, "Error ND_Address_Check: signal (Add SIGSEGV Hdl) errno: %d", errno);
|
||||||
|
ND_Error_Print();
|
||||||
|
|
||||||
|
return( NDS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Target address access try */
|
||||||
|
|
||||||
|
if( setjmp( NDG_Base.SigLongJmp_Env) == 0 )
|
||||||
|
{
|
||||||
|
test = *( (int *)Address);
|
||||||
|
|
||||||
|
status = NDS_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = NDS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Untrap SIGSEGV */
|
||||||
|
|
||||||
|
if( ( old_sigsegv_sighandler = signal( SIGSEGV, old_sigsegv_sighandler)) == SIG_ERR)
|
||||||
|
{
|
||||||
|
sprintf( NDG_Base.Err_String, "Error ND_Address_Check: signal (Remove SIGSEGV Hdl) errno: %d", errno);
|
||||||
|
ND_Error_Print();
|
||||||
|
|
||||||
|
return( NDS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return( status);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5654,7 +5694,11 @@ void ND_Signal_Trap( int Sig_Num)
|
|||||||
{
|
{
|
||||||
NDG_Base.Sig_Trapped = Sig_Num;
|
NDG_Base.Sig_Trapped = Sig_Num;
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
siglongjmp( NDG_Base.SigLongJmp_Env, 1);
|
siglongjmp( NDG_Base.SigLongJmp_Env, 1);
|
||||||
|
#else
|
||||||
|
longjmp( NDG_Base.SigLongJmp_Env, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* $RCSfile: libnode.h,v $ */
|
/* $RCSfile: libnode.h,v $ */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* $Revision: 2.6 $ */
|
/* $Revision: 2.7 $ */
|
||||||
/* $Name: $ */
|
/* $Name: $ */
|
||||||
/* $Date: 2004/08/02 21:26:03 $ */
|
/* $Date: 2004/08/23 22:47:22 $ */
|
||||||
/* $Author: agibert $ */
|
/* $Author: agibert $ */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -32,12 +32,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <setjmp.h>
|
# include <setjmp.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
//#include <dlfcn.h>
|
//#include <dlfcn.h>
|
||||||
|
|
||||||
@ -85,7 +82,11 @@ typedef struct NDT_Base
|
|||||||
char Err_String[512];
|
char Err_String[512];
|
||||||
FILE *Err_Stream;
|
FILE *Err_Stream;
|
||||||
int Sig_Trapped;
|
int Sig_Trapped;
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
sigjmp_buf SigLongJmp_Env;
|
sigjmp_buf SigLongJmp_Env;
|
||||||
|
#else
|
||||||
|
jmp_buf SigLongJmp_Env;
|
||||||
|
#endif
|
||||||
NDT_Symbol *Symbol_First_Ptr;
|
NDT_Symbol *Symbol_First_Ptr;
|
||||||
NDT_Index_Type OpenStruct_Index_Type[1];
|
NDT_Index_Type OpenStruct_Index_Type[1];
|
||||||
NDT_Root *OpenStruct_Ptr;
|
NDT_Root *OpenStruct_Ptr;
|
||||||
@ -97,7 +98,8 @@ NDT_Base NDG_Base =
|
|||||||
NDD_TRUE,
|
NDD_TRUE,
|
||||||
"",
|
"",
|
||||||
(FILE *) -1,
|
(FILE *) -1,
|
||||||
0,{},
|
0,
|
||||||
|
{0},
|
||||||
(NDT_Symbol *) NULL,
|
(NDT_Symbol *) NULL,
|
||||||
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
|
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
|
||||||
(NDT_Root *) NULL
|
(NDT_Root *) NULL
|
||||||
@ -105,8 +107,6 @@ NDT_Base NDG_Base =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//extern int sigrelse (int sig);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user