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 $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* $Revision: 2.8 $ */
|
||||
/* $Revision: 2.9 $ */
|
||||
/* $Name: $ */
|
||||
/* $Date: 2004/08/02 21:26:03 $ */
|
||||
/* $Date: 2004/08/23 22:47:22 $ */
|
||||
/* $Author: agibert $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
@ -31,20 +31,20 @@
|
||||
|
||||
|
||||
#ifndef _LIBNODE_H_
|
||||
#define _LIBNODE_H_
|
||||
# define _LIBNODE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
# include <stdlib.h>
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <stdarg.h>
|
||||
|
||||
#ifdef _LIBVER_SUPPORT
|
||||
# include <ver.h>
|
||||
#endif
|
||||
# ifdef _LIBVER_SUPPORT
|
||||
# include <ver.h>
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ typedef struct NDT_Root
|
||||
|
||||
NDT_Index_Nb Index_Nb;
|
||||
NDT_Index_Nb Index_Open_Count;
|
||||
NDT_Index Index_Tab[0];
|
||||
NDT_Index Index_Tab[1];
|
||||
|
||||
} NDT_Root;
|
||||
|
||||
@ -298,7 +298,7 @@ typedef struct NDT_DataStruct
|
||||
|
||||
typedef struct NDT_Node
|
||||
{
|
||||
NDT_Root *Root;
|
||||
NDT_Root *Root;
|
||||
NDT_Index_Id Index;
|
||||
struct NDT_Node *Parent;
|
||||
struct NDT_Node *Left;
|
||||
@ -909,8 +909,8 @@ NDD_DLL_API NDT_Status ND_Desallocator_Exec_C( NDT_Desallocator *, void *, vo
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* $RCSfile: libnode.c,v $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* $Revision: 2.11 $ */
|
||||
/* $Revision: 2.12 $ */
|
||||
/* $Name: $ */
|
||||
/* $Date: 2004/08/02 21:26:03 $ */
|
||||
/* $Date: 2004/08/23 22:47:22 $ */
|
||||
/* $Author: agibert $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#include <libnode.h>
|
||||
|
||||
#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
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
*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);
|
||||
}
|
||||
@ -369,7 +369,7 @@ NDT_Status ND_OpenStruct_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id,
|
||||
|
||||
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);
|
||||
}
|
||||
@ -702,12 +702,12 @@ NDT_Status ND_Library_Close_C( void)
|
||||
{
|
||||
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();
|
||||
|
||||
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();
|
||||
|
||||
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)
|
||||
{
|
||||
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();
|
||||
|
||||
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;
|
||||
|
||||
|
||||
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( strlen(Manager_Name) > NDD_MANAGER_NAME_LEN_MAX) return( NDS_ERRAPI);
|
||||
@ -5560,24 +5560,18 @@ 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)
|
||||
{
|
||||
#if !defined(_MSC_VER)
|
||||
NDT_Status status;
|
||||
int rc;
|
||||
int test;
|
||||
struct sigaction act =
|
||||
{
|
||||
ND_Signal_Trap, //
|
||||
0, //
|
||||
0, // sa_mask
|
||||
0, // sa_flags
|
||||
0 //
|
||||
}, oact_bus, oact_segv;
|
||||
NDT_Status status;
|
||||
int rc;
|
||||
int test;
|
||||
struct sigaction act = {0}, oact_bus, oact_segv;
|
||||
|
||||
act.sa_handler = ND_Signal_Trap;
|
||||
|
||||
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 )
|
||||
{
|
||||
@ -5638,7 +5632,53 @@ NDT_Status ND_Address_Check( void *Address)
|
||||
|
||||
return( status);
|
||||
#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
|
||||
}
|
||||
|
||||
@ -5654,7 +5694,11 @@ void ND_Signal_Trap( int Sig_Num)
|
||||
{
|
||||
NDG_Base.Sig_Trapped = Sig_Num;
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
siglongjmp( NDG_Base.SigLongJmp_Env, 1);
|
||||
#else
|
||||
longjmp( NDG_Base.SigLongJmp_Env, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* $RCSfile: libnode.h,v $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* $Revision: 2.6 $ */
|
||||
/* $Revision: 2.7 $ */
|
||||
/* $Name: $ */
|
||||
/* $Date: 2004/08/02 21:26:03 $ */
|
||||
/* $Date: 2004/08/23 22:47:22 $ */
|
||||
/* $Author: agibert $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
@ -32,12 +32,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
# include <errno.h>
|
||||
# include <signal.h>
|
||||
# include <setjmp.h>
|
||||
#endif
|
||||
|
||||
//#include <dlfcn.h>
|
||||
|
||||
@ -59,7 +56,7 @@
|
||||
|
||||
|
||||
|
||||
#define NDD_HUGE_LONG (long)0xFFFFFFL
|
||||
#define NDD_HUGE_LONG ( long) 0xFFFFFFL
|
||||
|
||||
|
||||
|
||||
@ -85,7 +82,11 @@ typedef struct NDT_Base
|
||||
char Err_String[512];
|
||||
FILE *Err_Stream;
|
||||
int Sig_Trapped;
|
||||
#if !defined(_MSC_VER)
|
||||
sigjmp_buf SigLongJmp_Env;
|
||||
#else
|
||||
jmp_buf SigLongJmp_Env;
|
||||
#endif
|
||||
NDT_Symbol *Symbol_First_Ptr;
|
||||
NDT_Index_Type OpenStruct_Index_Type[1];
|
||||
NDT_Root *OpenStruct_Ptr;
|
||||
@ -96,17 +97,16 @@ NDT_Base NDG_Base =
|
||||
NDD_FALSE,
|
||||
NDD_TRUE,
|
||||
"",
|
||||
(FILE *)-1,
|
||||
0,{},
|
||||
(NDT_Symbol *)NULL,
|
||||
(FILE *) -1,
|
||||
0,
|
||||
{0},
|
||||
(NDT_Symbol *) NULL,
|
||||
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
|
||||
(NDT_Root *)NULL
|
||||
(NDT_Root *) NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
//extern int sigrelse (int sig);
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
Loading…
Reference in New Issue
Block a user