*** empty log message ***

This commit is contained in:
glenux 2004-02-25 08:13:28 +00:00 committed by Glenn Y. Rolland
parent 6b13edc905
commit 6f750f3b1b
3 changed files with 31 additions and 25 deletions

View file

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

View file

@ -2,11 +2,11 @@
void * msgBufferMap(msgPoolData * poolDataTab, int poolIndex, int bufferIndex) {
void * resultAddr;
int bufferSize, bufferNb;
int poolBufferTabFd;
msgPoolId poolBufferTabId;
void * resultAddr;
int bufferSize, bufferNb;
int poolBufferTabFd;
msgPoolId poolBufferTabId;
printf("Mapping buffer (%d,%d)\n",poolIndex,bufferIndex);
// TODO: récuperer l'ID du BufferInfoTab;
strcpy(poolBufferTabId, poolDataTab[poolIndex].poolId);
bufferSize=poolDataTab[poolIndex].bufferSize;
@ -17,31 +17,36 @@ void * msgBufferMap(msgPoolData * poolDataTab, int poolIndex, int bufferIndex) {
NZG_ERROR("shm_open",poolBufferTabId);
goto ERROR;
}
// mapper le buffer dans l'espace mémoire du processus
/* on s'arrete juste derriere l'index qui nous intéresse */
resultAddr=mmap(NULL,
bufferSize*(bufferIndex+1),
PROT_NONE,
MAP_SHARED,
poolBufferTabFd,
(off_t)0);
if(resultAddr == MAP_FAILED) {
NZG_ERROR("mmap", poolBufferTabId);
goto ERROR;
}
bufferSize*(bufferIndex+1),
PROT_READ|PROT_WRITE, //PROT_NONE
MAP_SHARED,
poolBufferTabFd,
(off_t)0);
if(resultAddr == MAP_FAILED) {
NZG_ERROR("mmap", poolBufferTabId);
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(
resultAddr,
bufferSize,
PROT_READ|PROT_WRITE
);
/* mprotect(
resultAddr,
bufferSize,
PROT_READ|PROT_WRITE
);*/
close(poolBufferTabFd);
close(poolBufferTabFd);
return resultAddr;
return resultAddr;
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);
/* bufferInfoTabInit.c */
int msgBufferInfoTabInit(msgPoolData *poolDataTabAddr, int poolIndex);
/* bufferMap.c */
void *msgBufferMap(msgPoolData *poolDataTab, int poolIndex, int bufferIndex);
/* free.c */
int msgFree(msgSpace *space, void *addr);
/* get.c */