From c760b616ec10690e055affd2805e93b82d4763ef Mon Sep 17 00:00:00 2001 From: glenux Date: Thu, 19 Feb 2004 21:21:52 +0000 Subject: [PATCH] *** empty log message *** --- src/nzg_global.h | 2 ++ src/nzg_iface.h | 11 ++++++----- src/nzg_pool.c | 8 +++++++- src/nzg_spaces.c | 16 ++++++++++++---- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/nzg_global.h b/src/nzg_global.h index 57f26ab..7daaa20 100644 --- a/src/nzg_global.h +++ b/src/nzg_global.h @@ -11,5 +11,7 @@ #include #define PAGESIZE sysconf(_SC_PAGESIZE) +#define MSGSPACE_DEFAULT_MODE 0600 +#define MSGSPACE_ID_LEN 32 #endif diff --git a/src/nzg_iface.h b/src/nzg_iface.h index 33fff99..9462421 100644 --- a/src/nzg_iface.h +++ b/src/nzg_iface.h @@ -1,11 +1,7 @@ #ifndef _NZG_IFACE #define _NZG_IFACE 1 - #include "nzg_global.h" -#define MSGSPACE_DEFAULT_MODE 0600 -#define MSGSPACE_ID_LEN 32 - typedef char msgSpaceId[MSGSPACE_ID_LEN]; typedef char msgSpaceListId[4*MSGSPACE_ID_LEN]; @@ -19,12 +15,17 @@ typedef char msgSpaceQueueId[4*MSGSPACE_ID_LEN]; /* pid[] */ /* liste des processus demandeurs */ typedef struct MsgPool { + int bufferSize; + int bufferNb; +} msgPool; + +typedef struct MsgPoolData { msgSpacePoolId id; int bufferNb; int bufferSize; int allocDispBuffer; int allocOverload; -} msgPool; +} msgPoolData; /* TODO: queueId */ diff --git a/src/nzg_pool.c b/src/nzg_pool.c index af0fc8e..124a29b 100644 --- a/src/nzg_pool.c +++ b/src/nzg_pool.c @@ -55,9 +55,15 @@ int msgSpacePoolId2nzgPoolId(msgSpacePoolId dest,msgSpacePoolId src, int num){ // //donne l'adr en mappant in the memory //poolAddr = mmap(NULL, sizeof(*msgPool), PROT_NONE, MAP_SHARED, poolFd, 0); -msgPool * msgPoolAllocate(int poolFd, msgSpace *msg) { +msgPool * msgPoolAllocate(int poolIdx, msgSpace *msg) { msgPool * poolAddr; int dataId; + + // TODO:récupérer l'id du poolData dans le msgSpace + // détacher le morceau de mémoire du processus + + // TODO:récupérer l'id de la pool (poolIdx) qui nous intéresse + // ouvrir la //msgSpacePoolData spoolData; //dataId = msg->poolDataId; diff --git a/src/nzg_spaces.c b/src/nzg_spaces.c index 970c2d1..74e997a 100644 --- a/src/nzg_spaces.c +++ b/src/nzg_spaces.c @@ -1,7 +1,11 @@ #include "libnazgul.h" -/* prototypes des fonctions annexes à ne pas exporter */ - int msgSpaceIdIntern(msgSpaceId dest,const msgSpaceId src ); +/* prototypes des f#define MSGSPACE_DEFAULT_MODE 0600 +#define MSGSPACE_ID_LEN 32 + +onctions annexes à ne pas exporter */ +int msgSpaceIdIntern(msgSpaceId dest,const msgSpaceId src ); +int msgPoolDataIdIntern(msgSpaceId dest,const msgSpaceId src ); /* * spaceId : identifiant externe de l'espace de msg @@ -22,6 +26,8 @@ msgSpace * msgSpaceCreate( static int mSIdNum=-1; msgSpace * mSAddr; + msgSpacePoolId poolDataId; + msgPoolData * mSPoolDataAddr; fprintf(stderr,"Creating msgSpace with id : %s\n",spaceId); @@ -77,7 +83,9 @@ msgSpace * msgSpaceCreate( mSAddr->pid=getpid(); /* TODO: creation du poolData */ - + msgPoolDataIdIntern(poolDataId,spaceId); + + /* TODO: on ajoute spaceId a la liste des msgSpace connus */ /* TODO: on crée queueNb files de messages */ @@ -143,7 +151,7 @@ int msgSpaceIdIntern(msgSpaceId dest,const msgSpaceId src ){ return 0; } -int msgSpacePoolDataIdIntern(msgSpaceId dest,const msgSpaceId src ){ +int msgPoolDataIdIntern(msgSpaceId dest,const msgSpaceId src ){ if (strlen(src)>MSGSPACE_ID_LEN){ return -1; }