2024-04-17 18:49:56 +02:00
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* shmem.h */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
2024-04-20 10:11:27 +02:00
|
|
|
|
/* This file is part of LibShMem. */
|
2024-04-17 18:49:56 +02:00
|
|
|
|
/* */
|
|
|
|
|
/* LibShMem is free software: you can redistribute it and/or modify it */
|
|
|
|
|
/* under the terms of the GNU Lesser General Public License as published */
|
|
|
|
|
/* by the Free Software Foundation, either version 3 of the License, or */
|
|
|
|
|
/* (at your option) any later version. */
|
|
|
|
|
/* */
|
|
|
|
|
/* LibShMem is distributed in the hope that it will be useful, */
|
|
|
|
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
|
|
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
|
|
|
/* GNU Lesser General Public License for more details. */
|
|
|
|
|
/* */
|
|
|
|
|
/* You should have received a copy of the GNU Lesser General Public */
|
2024-04-20 10:11:27 +02:00
|
|
|
|
/* License along with LibShMem. If not, see */
|
2024-04-17 18:49:56 +02:00
|
|
|
|
/* <https://www.gnu.org/licenses/>. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Includes */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
2005-01-24 23:57:06 +01:00
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
#ifndef _LIBSM
|
|
|
|
|
#define _LIBSM
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2024-04-15 16:54:18 +02:00
|
|
|
|
//extern "C" {
|
2000-07-28 16:13:54 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <sys/types.h>
|
2024-04-17 18:49:56 +02:00
|
|
|
|
|
|
|
|
|
#include <log.h>
|
2000-07-28 16:13:54 +02:00
|
|
|
|
#include <node.h>
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Definitions */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* SMD_API definition */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
# ifdef _LIBSHMEM_C_
|
|
|
|
|
# define SMD_API
|
|
|
|
|
# define SMD_DATA
|
|
|
|
|
# else
|
|
|
|
|
# define SMD_API extern
|
|
|
|
|
# define SMD_DATA extern
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/* Code retour des fonctions constituant l'API */
|
2024-04-14 20:00:25 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
typedef long SMT_Status;
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
|
|
|
|
#define SMS_OK NDS_OK /* La fonction s'est correctement ex<65>cut<75>e et a produit un r<>sultat */
|
|
|
|
|
#define SMS_KO NDS_KO /* La fonction s'est correctement ex<65>cut<75>e mais n'a pas produit de r<>sultat */
|
|
|
|
|
#define SMS_NO_WAIT 2 /* Op<4F>ration sur s<>maphore en mode IPC_NOWAIT qui n'a pas pu aboutir */
|
|
|
|
|
|
|
|
|
|
#define SMS_YES SMS_OK /* R<>sultat bool<6F>en positif */
|
|
|
|
|
#define SMS_NO SMS_KO /* R<>sultat bool<6F>en n<>gatif */
|
|
|
|
|
|
|
|
|
|
#define SMS_ERRMEM NDS_ERRMEM /* Probl<62>me d'allocation m<>moire */
|
|
|
|
|
#define SMS_ERRAPI NDS_ERRAPI /* Utilisation incorrecte des API */
|
|
|
|
|
#define SMS_ERRSHM -3 /* Probl<62>me relatif aux segments de m<>moire partag<61>e */
|
|
|
|
|
#define SMS_ERRSEM -4 /* Probl<62>me relatif <20> l'utilisation des s<>maphores */
|
|
|
|
|
#define SMS_ERRSIG -5 /* Op<4F>ration sur s<>maphore interrompue par un signal */
|
|
|
|
|
|
|
|
|
|
#define SM_ERROR(s) ((s) < 0) /* Tous les codes retour n<>gatifs correspondent <20> des erreurs */
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define SMD_NAME_LEN (short) 256
|
|
|
|
|
#define SMD_NAME_SIZE (SMD_NAME_LEN + 1)
|
2024-04-24 20:32:44 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef int SMT_Flags;
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
|
|
|
|
#define SMD_UNDEF 0
|
|
|
|
|
|
|
|
|
|
/* Flags d'ouverture d'un heap ou d'une instance de la librairie */
|
|
|
|
|
|
|
|
|
|
#define SMD_CREATE 0x01 /* Cr<43>ation */
|
|
|
|
|
#define SMD_OPEN 0x02 /* Ouverture simple */
|
|
|
|
|
#define SMD_DESTROY 0x04 /* Destruction */
|
|
|
|
|
#define SMD_CLOSE 0x08 /* Fermeture simple */
|
|
|
|
|
|
|
|
|
|
/* NB : pour l'ouverture de la librairie, les valeurs SMD_OPEN et SMD_CREATE sont mutuellement exclusives */
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/* Flags de verrouillage */
|
|
|
|
|
|
|
|
|
|
#define SMD_READ 0x04 /* verrou partag<61> */
|
|
|
|
|
#define SMD_WRITE 0x08 /* verrou exclusif */
|
|
|
|
|
#define SMD_NO_LOCK 0x00 /* aucun verrou */
|
|
|
|
|
|
|
|
|
|
#define SMD_LOCK_MSK(a) ((a) & (SMD_READ|SMD_WRITE))
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/* Mode de debug sur l'ouverture de la librairie */
|
|
|
|
|
|
|
|
|
|
#define SMD_DEBUG_NONE 0x00 /* pour n'afficher aucun message g<>n<EFBFBD>r<EFBFBD> par les diverses librairies */
|
|
|
|
|
#define SMD_DEBUG 0x10 /* pour afficher les messages g<>n<EFBFBD>r<EFBFBD>s par la librairie */
|
|
|
|
|
#define SMD_DEBUG_ALL 0x20 /* pour afficher les messages g<>n<EFBFBD>r<EFBFBD>s par toutes les librairies sous-jacentes */
|
|
|
|
|
|
|
|
|
|
#define SMD_DEBUG_MSK(a) ((a) & (SMD_DEBUG|SMD_DEBUG_ALL))
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/* Diff<66>rentes types de configuration d'un heap */
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
typedef int SMT_Config;
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
|
|
|
|
#define SMD_SEGMENT_SIZE 1 /* D<>finir la taille des segments */
|
|
|
|
|
#define SMD_HEAP_LIMIT 2 /* D<>finir la taille maximale */
|
|
|
|
|
#define SMD_AUTO_COMPRESS 3 /* D<>finir la taille d'un FCR <20> partir de laquelle
|
2005-01-24 23:57:06 +01:00
|
|
|
|
la compression du heap est autmatiquement activ<EFBFBD>e */
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
|
|
|
|
#define SMD_DEFAULT_COMPRESS 1000 /* si + de 1000 chunks libres, alors compression du heap */
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/* Diff<66>rentes valeurs de configuration */
|
|
|
|
|
|
|
|
|
|
#define SMD_UNLIMITED 0
|
|
|
|
|
#define SMD_NO_AUTO_COMPRESS 0
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/* Nom du heap syst<73>me */
|
|
|
|
|
|
|
|
|
|
#define HEAP_SYSTEM "system"
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
#ifndef FALSE
|
|
|
|
|
#define FALSE 0
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef TRUE
|
|
|
|
|
#define TRUE 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-24 20:32:44 +02:00
|
|
|
|
SMD_DATA char SM_Error_Msg[ 512];
|
2024-04-17 18:49:56 +02:00
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Structure de la base de heaps */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
|
2024-04-24 20:32:44 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int SysMemId; /* Id de la 1<>re zone de m<>moire partag<61>e de la base */
|
|
|
|
|
int DataMemId; /* Id de la 2<>me zone de m<>moire partag<61>e de la base */
|
|
|
|
|
size_t Size; /* Taille de la zone de m<>moire partag<61>e */
|
|
|
|
|
int SemId; /* Id du s<>maphore pour la gestion des verrous */
|
|
|
|
|
NDT_Root * MHR; /* Memory Heap Root : racine de la liste de heap */
|
|
|
|
|
pid_t Creator; /* Id du processus cr<63>ateur de la base */
|
|
|
|
|
pid_t Writer; /* Id du dernier processus ayant acc<63>d<EFBFBD> en <20>criture <20> la base */
|
|
|
|
|
void * Free; /* Pointeur sur la premi<6D>re zone libre de la base */
|
|
|
|
|
void * Attach; /* Adresse du dernier attachement */
|
|
|
|
|
size_t Segment_Size; /* Taille par d<>faut des segments qui composeront les heaps */
|
|
|
|
|
} SMT_Base;
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
|
|
|
|
/* R<>f<EFBFBD>rence sur la base de heaps */
|
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_DATA SMT_Base * SM_Base;
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Structure d'un MHH (Memory Heap Header) */
|
|
|
|
|
/* Rappel : un MHH est une valeur attach<63>e <20> un MHN (Memory Heap Node) */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
|
2024-04-24 20:32:44 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
char Name[ SMD_NAME_SIZE]; /* Nom du heap */
|
2024-04-15 16:54:18 +02:00
|
|
|
|
int SemId; /* Id du s<>maphore pour la gestion des verrous */
|
|
|
|
|
NDT_Root *DSR; /* Data Segment Root */
|
|
|
|
|
NDT_Root *ACR; /* Allocated Chunks Root */
|
|
|
|
|
NDT_Root *FCR; /* Free Chunks Root */
|
|
|
|
|
pid_t Writer; /* Id du processus ayant acc<63>d<EFBFBD> en dernier au MHH en <20>criture */
|
|
|
|
|
int State; /* Etat d'un heap (valide, non valid<69> ou corrompu) */
|
|
|
|
|
size_t Segment_Size; /* Taille des segments de m<>moire composant le heap */
|
|
|
|
|
size_t Limit_Size; /* Taille limite du heap (par d<>faut : pas de limite) */
|
|
|
|
|
int Auto_Compress; /* Nombre de chunks libres <20> partir duquel le heap est automatiquement compress<73> */
|
|
|
|
|
long Compress_Nb; /* Nomber of time the heap has been compressed */
|
|
|
|
|
} SMT_MHH;
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-24 20:32:44 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/* Heap ouvert */
|
|
|
|
|
|
2024-04-24 20:32:44 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
char *Name;
|
|
|
|
|
SMT_MHH *MHH;
|
2024-04-15 16:54:18 +02:00
|
|
|
|
SMT_Flags Lock_Mode; /* Mode dans lequel le heap est verrouill<6C> */
|
|
|
|
|
int Nb_Seg; /* Nombre de segments du heap lors de son ouverture */
|
|
|
|
|
} SMT_Heap;
|
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Structure d'un DSH (Data Segment Header) */
|
|
|
|
|
/* Rappel : un DSH est une valeur attach<63>e <20> un DSN (noeud de DSR) */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
|
2024-04-24 20:32:44 +02:00
|
|
|
|
typedef struct {
|
|
|
|
|
int MemId; /* Id de la zone de m<>moire partag<61>e */
|
|
|
|
|
size_t Size; /* Taille de la zone de m<>moire partag<61>e */
|
|
|
|
|
void *Start; /* Adresse de d<>but de la zone de m<>moire partag<61>e */
|
|
|
|
|
} SMT_DSH;
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Structure d'un chunk */
|
|
|
|
|
/* Rappel : un chunk est la valeur attach<63>e <20> un noeud de ACR ou FCR */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
|
2024-04-24 20:32:44 +02:00
|
|
|
|
typedef struct {
|
|
|
|
|
size_t Size; /* Taille allou<6F>e au chunk */
|
|
|
|
|
void *Data; /* Adresse de la zone de donn<6E>es du chunk */
|
|
|
|
|
} SMT_Chunk;
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Alias API definition */
|
|
|
|
|
|
|
|
|
|
#ifndef SM_MODE
|
|
|
|
|
#define SM_MODE 0
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if SM_MODE == 1 /* API sans v<>rification des arguments */
|
|
|
|
|
|
|
|
|
|
#define SM_Library_Open SM_Library_Open_I
|
|
|
|
|
#define SM_Library_Instance_Get SM_Library_Instance_Get_I
|
|
|
|
|
#define SM_Library_Context_Set SM_Library_Context_Set_I
|
|
|
|
|
#define SM_Library_Context_Get SM_Library_Context_Get_I
|
|
|
|
|
#define SM_Library_Close SM_Library_Close_I
|
|
|
|
|
#define SM_Library_Dump SM_Library_Dump_I
|
|
|
|
|
#define SM_Library_Unlock SM_Library_Unlock_I
|
|
|
|
|
#define SM_Library_Stderr_Set SM_Library_Stderr_Set_I
|
2024-05-06 19:15:34 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
#define SM_Heap_Exist SM_Heap_Exist_I
|
|
|
|
|
#define SM_Heap_Open SM_Heap_Open_I
|
|
|
|
|
#define SM_Heap_IsOpen SM_Heap_IsOpen_I
|
|
|
|
|
#define SM_Heap_Close SM_Heap_Close_I
|
|
|
|
|
#define SM_Heap_End SM_Heap_End_I
|
|
|
|
|
#define SM_Heap_Compress SM_Heap_Compress_I
|
|
|
|
|
#define SM_Heap_Config SM_Heap_Config_I
|
|
|
|
|
#define SM_Heap_Check SM_Heap_Check_I
|
|
|
|
|
#define SM_Heap_Lock SM_Heap_Lock_I
|
|
|
|
|
#define SM_Heap_Unlock SM_Heap_Unlock_I
|
2024-05-06 19:15:34 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
#define SM_Chunk_Alloc SM_Chunk_Alloc_I
|
|
|
|
|
#define SM_Chunk_Free SM_Chunk_Free_I
|
|
|
|
|
|
|
|
|
|
#else /* API avec v<>rification des arguments */
|
|
|
|
|
|
|
|
|
|
#define SM_Library_Open SM_Library_Open_C
|
|
|
|
|
#define SM_Library_Instance_Get SM_Library_Instance_Get_C
|
|
|
|
|
#define SM_Library_Context_Set SM_Library_Context_Set_C
|
|
|
|
|
#define SM_Library_Context_Get SM_Library_Context_Get_C
|
|
|
|
|
#define SM_Library_Close SM_Library_Close_C
|
|
|
|
|
#define SM_Library_Dump SM_Library_Dump_C
|
|
|
|
|
#define SM_Library_Unlock SM_Library_Unlock_C
|
|
|
|
|
#define SM_Library_Stderr_Set SM_Library_Stderr_Set_C
|
2024-05-06 19:15:34 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
#define SM_Heap_Exist SM_Heap_Exist_C
|
|
|
|
|
#define SM_Heap_Open SM_Heap_Open_C
|
|
|
|
|
#define SM_Heap_IsOpen SM_Heap_IsOpen_C
|
|
|
|
|
#define SM_Heap_Close SM_Heap_Close_C
|
|
|
|
|
#define SM_Heap_End SM_Heap_End_C
|
|
|
|
|
#define SM_Heap_Compress SM_Heap_Compress_C
|
|
|
|
|
#define SM_Heap_Config SM_Heap_Config_C
|
|
|
|
|
#define SM_Heap_Check SM_Heap_Check_C
|
|
|
|
|
#define SM_Heap_Lock SM_Heap_Lock_C
|
|
|
|
|
#define SM_Heap_Unlock SM_Heap_Unlock_C
|
2024-05-06 19:15:34 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
#define SM_Chunk_Alloc SM_Chunk_Alloc_C
|
|
|
|
|
#define SM_Chunk_Free SM_Chunk_Free_C
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Ouverture d'une instance de la librairie */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Instance : num<75>ro d'instance de la librairie */
|
|
|
|
|
/* (I) Context : nom du nouveau contexte */
|
|
|
|
|
/* (I) Flags : indicateur cr<63>ation/ouverture + mode d'affichage des erreurs */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Library_Open_I ( int Instance, const char * Context, SMT_Flags Flags );
|
|
|
|
|
SMD_API SMT_Status SM_Library_Open_C ( int Instance, const char * Context, SMT_Flags Flags );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* R<>cup<75>ration du num<75>ro de l'instance utilis<69>e */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (O) Instance : adresse du num<75>ro de l'instance utilis<69>e */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Library_Instance_Get_I ( int * Instance);
|
|
|
|
|
SMD_API SMT_Status SM_Library_Instance_Get_C ( int * Instance);
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Changement de contexte d'utilisation de la librairie */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Context : nom du nouveau contexte */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Library_Context_Set_I ( const char * Context );
|
|
|
|
|
SMD_API SMT_Status SM_Library_Context_Set_C ( const char * Context );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* R<>cup<75>ration du nom du contexte utilis<69> */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (O) Context : adresse du nom du contexte utilis<69> */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Library_Context_Get_I ( char ** Context );
|
|
|
|
|
SMD_API SMT_Status SM_Library_Context_Get_C ( char ** Context );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Fermeture de l'instance de la librairie */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Flags : mode de fermeture (destruction ou fermeture simple) */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Library_Close_I ( SMT_Flags Flags );
|
|
|
|
|
SMD_API SMT_Status SM_Library_Close_C ( SMT_Flags Flags );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Affichage des informations de la base de m<>moires partag<61>es */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Out : pointeur sur le flux de sortie */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Library_Dump_I ( FILE * Out );
|
|
|
|
|
SMD_API SMT_Status SM_Library_Dump_C ( FILE * Out );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Lib<69>ration de tous les verrous (base, heap) */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Library_Unlock_I ( void );
|
|
|
|
|
SMD_API SMT_Status SM_Library_Unlock_C ( void );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* D<>finition de la sortie standard des messages d'erreur de la librairie */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Library_Stderr_Set_I ( FILE * Out );
|
|
|
|
|
SMD_API SMT_Status SM_Library_Stderr_Set_C ( FILE * Out );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Test d'existence d'un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap_Name : nom du heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_Exist_I ( const char * Heap_Name );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_Exist_C ( const char * Heap_Name );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Ouverture/cr<63>ation d'un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap_Name : nom du heap */
|
|
|
|
|
/* (O) Heap : pointeur sur le heap ouvert / cr<63><72> */
|
|
|
|
|
/* (I) Seg_Size : taille des segments du heap */
|
|
|
|
|
/* (I) Flags : mode d'ouverture du heap */
|
|
|
|
|
/* (O) Locked : verrou effectif (TRUE ou FALSE) */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_Open_I ( const char * Heap_Name, SMT_Heap ** Heap, size_t Seg_Size, SMT_Flags Flags, int * Locked );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_Open_C ( const char * Heap_Name, SMT_Heap ** Heap, size_t Seg_Size, SMT_Flags Flags, int * Locked );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Teste si un heap a d<>j<EFBFBD> <20>t<EFBFBD> ouvert par le processus courant */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap_Name : nom du heap */
|
|
|
|
|
/* (O) Heap : adresse du pointeur sur le heap ouvert */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_IsOpen_I ( const char * Heap_Name, SMT_Heap ** Heap );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_IsOpen_C ( const char * Heap_Name, SMT_Heap ** Heap );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Fermeture d'un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap : pointeur sur un heap ouvert */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_Close_I ( SMT_Heap * Heap );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_Close_C ( SMT_Heap * Heap );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Destruction d'un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap_Name : nom du heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_End_I ( const char * Heap_Name );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_End_C ( const char * Heap_Name );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Compression d'un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap : pointeur sur un heap ouvert */
|
|
|
|
|
/* (O) Compress : pointeur sur la taille m<>moire gagn<67>e */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_Compress_I ( SMT_Heap * Heap, size_t * Compress );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_Compress_C ( SMT_Heap * Heap, size_t * Compress );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Configuration d'un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap : pointeur sur un heap ouvert */
|
|
|
|
|
/* (I) Tag : type de configuration */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_Config_I ( SMT_Heap * Heap, SMT_Config Tag, ... );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_Config_C ( SMT_Heap * Heap, SMT_Config Tag, ... );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* V<>rification/correction des structures d'un heap : */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap : pointeur sur un heap ouvert */
|
|
|
|
|
/* (O) Nb_Detected : pointeur sur le nombre d'erreurs d<>tect<63>es */
|
|
|
|
|
/* (O) Nb_Corrected : pointeur sur le nombre d'erreurs corrig<69>es */
|
|
|
|
|
/* (I) Out : pointeur sur le flux de sortie du rapport */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_Check_I ( SMT_Heap * Heap, int * Nb_Detected, int * Nb_Corrected, FILE * Out);
|
|
|
|
|
SMD_API SMT_Status SM_Heap_Check_C ( SMT_Heap * Heap, int * Nb_Detected, int * Nb_Corrected, FILE * Out);
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Pose d'un verrou sur un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap : pointeur sur un heap ouvert */
|
|
|
|
|
/* (I) Flags : mode de verrouillage (SMD_READ ou SMD_WRITE) */
|
|
|
|
|
/* (O) Locked : verrouillage effectu<74> (TRUE ou FALSE) */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_Lock_I ( SMT_Heap * Heap, SMT_Flags Flags, int * Locked );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_Lock_C ( SMT_Heap * Heap, SMT_Flags Flags, int * Locked );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Lib<69>ration d'un verrou sur un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap : pointeur sur un heap ouvert */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Heap_Unlock_I ( SMT_Heap * Heap );
|
|
|
|
|
SMD_API SMT_Status SM_Heap_Unlock_C ( SMT_Heap * Heap );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* Allocation d'un chunk dans un heap */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap : pointeur sur un heap ouvert */
|
|
|
|
|
/* (I) Size : taille du chunk */
|
|
|
|
|
/* (O) Ptr : pointeur sur la zone de donn<6E>es allou<6F>e */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Chunk_Alloc_I ( SMT_Heap * Heap, size_t Alloc_Size, void ** Ptr );
|
|
|
|
|
SMD_API SMT_Status SM_Chunk_Alloc_C ( SMT_Heap * Heap, size_t Alloc_Size, void ** Ptr );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* D<>sallocation d'un chunk */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
/* (I) Heap : pointeur sur un heap ouvert */
|
|
|
|
|
/* (I) Ptr : adresse de la zone de donn<6E>es du chunk <20> d<>sallouer */
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
2024-04-19 18:44:32 +02:00
|
|
|
|
|
2024-04-17 18:49:56 +02:00
|
|
|
|
SMD_API SMT_Status SM_Chunk_Free_I ( SMT_Heap * Heap, void * Ptr );
|
|
|
|
|
SMD_API SMT_Status SM_Chunk_Free_C ( SMT_Heap * Heap, void * Ptr );
|
2000-07-28 16:13:54 +02:00
|
|
|
|
|
2024-04-15 16:54:18 +02:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 16:13:54 +02:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|