From d78d181ef5f1cd9ee1ca15a5d28bc99d130cb5b7 Mon Sep 17 00:00:00 2001 From: glenux Date: Tue, 24 Feb 2004 08:57:52 +0000 Subject: [PATCH] *** empty log message *** --- src/ids.c | 14 ++++++++++++++ src/iface.h | 1 + src/proto.h | 3 ++- src/spaceListElemCreate.c | 10 +++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/ids.c b/src/ids.c index 2ce117a..790600d 100644 --- a/src/ids.c +++ b/src/ids.c @@ -128,5 +128,19 @@ int msgQueueElemIdIntern( return 0; } +int spaceListElemIdIntern(msgSpaceListElemId elemListId,msgSpaceId externId){ + if (strlen(externId)>MSGSPACE_ID_LEN){ + return -1; + } + /* sprintf(resNzgId,"/tmp/.nzg-%s",(char *)spaceId); */ +#ifdef _NZG_REALFILEID + sprintf(elemListId,"/tmp/nzgSpaceListElem-%s",(char *)externId); +#else + sprintf(elemListId,"/nzgSpaceListElem-%s",(char *)externId); +#endif + return 0; + +} + #endif diff --git a/src/iface.h b/src/iface.h index 95a9240..9fcc337 100644 --- a/src/iface.h +++ b/src/iface.h @@ -60,6 +60,7 @@ typedef struct MsgSpace { typedef struct MsgSpaceListElem { int ownerPid; + msgSpaceId spaceId; msgSpaceListElemId next; } msgSpaceListElem; diff --git a/src/proto.h b/src/proto.h index 8a2123d..ecbd732 100644 --- a/src/proto.h +++ b/src/proto.h @@ -29,6 +29,7 @@ int msgBufferInfoTabIdIntern(msgBufferInfoTabId dest, msgSpaceId src, int num); int msgQueueSemIdIntern(msgQueueSemId dest, msgSpaceId externId, int queueIdx); int msgQueueIdIntern(msgQueueId dest, msgSpaceId externId, int queueIdx); int msgQueueElemIdIntern(msgQueueElemId dest, msgQueueId src, int counter); +int spaceListElemIdIntern(msgSpaceListElemId elemListId, msgSpaceId externId); /* list.c */ /* poolCreate.c */ int msgPoolCreate(msgSpaceId externId, int poolIdx, int buffNb, int buffSize); @@ -73,7 +74,7 @@ msgSpace *msgSpaceCreate(msgSpaceId externId, int queueNb, int poolNb, msgPool * int msgSpaceDelete(msgSpaceId externId); /* spaceListAdd.c */ /* spaceListElemCreate.c */ -int msgSpaceListElemCreate(msgSpaceListElemId elemenListId, msgSpaceId spaceId); +int msgSpaceListElemCreate(msgSpaceListElemId elemenListId, msgSpace *space); /* spaceListElemLink.c */ /* spaceListInit.c */ int msgSpaceListInit(void); diff --git a/src/spaceListElemCreate.c b/src/spaceListElemCreate.c index 10445dc..100a111 100644 --- a/src/spaceListElemCreate.c +++ b/src/spaceListElemCreate.c @@ -2,12 +2,13 @@ #include "ids.h" // cree un nouvel elemen -int msgSpaceListElemCreate(msgSpaceListElemId elemenListId,msgSpaceId spaceId){ +int msgSpaceListElemCreate(msgSpaceListElemId elemenListId,msgSpace * space){ int shmElemenList; + /*Creation de lid pour lespace de message*/ - spaceListElemIdIntern(elemenListId,spaceId); + spaceListElemIdIntern(elemenListId,space->externId); if ((shmElemenList=shm_open(elemenListId, @@ -21,8 +22,11 @@ int msgSpaceListElemCreate(msgSpaceListElemId elemenListId,msgSpaceId spaceId){ NZG_ERROR("ftruncate",elemenListId); goto ERROR; }; + close (shmElemenList); - + //TODO: mapper le shm en mémoire et remplir avec des informations + + //strcpy(spaceListElem->spaceId,space->id); return 0; ERROR: return-1;