*** empty log message ***

This commit is contained in:
glenux 2004-02-25 08:13:28 +00:00
parent 4d535fd155
commit d353ea2966
3 changed files with 31 additions and 25 deletions

View file

@ -186,7 +186,6 @@ void * msgAllocate(msgSpace *space,
int bufferFreeSize; int bufferFreeSize;
bufferFreeSize=mSPoolDataTabAddr[selectedPoolIndex].bufferSize; bufferFreeSize=mSPoolDataTabAddr[selectedPoolIndex].bufferSize;
printf("BufferSize : %d", bufferFreeSize); printf("BufferSize : %d", bufferFreeSize);
<<<<<<< allocate.c
resultAddr=msgBufferMap(mSPoolDataTabAddr,selectedPoolIndex,bufferFreeIndex); resultAddr=msgBufferMap(mSPoolDataTabAddr,selectedPoolIndex,bufferFreeIndex);
if (resultAddr==NULL){ if (resultAddr==NULL){

View file

@ -2,11 +2,11 @@
void * msgBufferMap(msgPoolData * poolDataTab, int poolIndex, int bufferIndex) { void * msgBufferMap(msgPoolData * poolDataTab, int poolIndex, int bufferIndex) {
void * resultAddr; void * resultAddr;
int bufferSize, bufferNb; int bufferSize, bufferNb;
int poolBufferTabFd; int poolBufferTabFd;
msgPoolId poolBufferTabId; msgPoolId poolBufferTabId;
printf("Mapping buffer (%d,%d)\n",poolIndex,bufferIndex);
// TODO: récuperer l'ID du BufferInfoTab; // TODO: récuperer l'ID du BufferInfoTab;
strcpy(poolBufferTabId, poolDataTab[poolIndex].poolId); strcpy(poolBufferTabId, poolDataTab[poolIndex].poolId);
bufferSize=poolDataTab[poolIndex].bufferSize; bufferSize=poolDataTab[poolIndex].bufferSize;
@ -17,31 +17,36 @@ void * msgBufferMap(msgPoolData * poolDataTab, int poolIndex, int bufferIndex) {
NZG_ERROR("shm_open",poolBufferTabId); NZG_ERROR("shm_open",poolBufferTabId);
goto ERROR; goto ERROR;
} }
// mapper le buffer dans l'espace mémoire du processus // mapper le buffer dans l'espace mémoire du processus
/* on s'arrete juste derriere l'index qui nous intéresse */ /* on s'arrete juste derriere l'index qui nous intéresse */
resultAddr=mmap(NULL, resultAddr=mmap(NULL,
bufferSize*(bufferIndex+1), bufferSize*(bufferIndex+1),
PROT_NONE, PROT_READ|PROT_WRITE, //PROT_NONE
MAP_SHARED, MAP_SHARED,
poolBufferTabFd, poolBufferTabFd,
(off_t)0); (off_t)0);
if(resultAddr == MAP_FAILED) { if(resultAddr == MAP_FAILED) {
NZG_ERROR("mmap", poolBufferTabId); NZG_ERROR("mmap", poolBufferTabId);
goto ERROR; goto ERROR;
} }
printf( "Mapped from 0x%08x\n to 0x%08x\n",
(int)resultAddr,
(int)resultAddr+ bufferSize*(bufferIndex+1)
);
resultAddr=resultAddr +( bufferSize*bufferIndex); resultAddr=resultAddr +( bufferSize*bufferIndex);
printf( "Moved to 0x%08x\n",(int)resultAddr );
mprotect( /* mprotect(
resultAddr, resultAddr,
bufferSize, bufferSize,
PROT_READ|PROT_WRITE PROT_READ|PROT_WRITE
); );*/
close(poolBufferTabFd); close(poolBufferTabFd);
return resultAddr; return resultAddr;
ERROR: ERROR:
return NULL; return NULL;
} }

View file

@ -17,6 +17,8 @@ int msgBufferGetProcAttach(msgPoolData *poolDataTabAddr, int poolNb, int *poolIn
int msgBufferInfoTabCreate(msgSpaceId externId, msgPoolData *poolDataTabAddr, int poolIdx, int bufferNb); int msgBufferInfoTabCreate(msgSpaceId externId, msgPoolData *poolDataTabAddr, int poolIdx, int bufferNb);
/* bufferInfoTabInit.c */ /* bufferInfoTabInit.c */
int msgBufferInfoTabInit(msgPoolData *poolDataTabAddr, int poolIndex); int msgBufferInfoTabInit(msgPoolData *poolDataTabAddr, int poolIndex);
/* bufferMap.c */
void *msgBufferMap(msgPoolData *poolDataTab, int poolIndex, int bufferIndex);
/* free.c */ /* free.c */
int msgFree(msgSpace *space, void *addr); int msgFree(msgSpace *space, void *addr);
/* get.c */ /* get.c */