*** empty log message ***

This commit is contained in:
glenux 2004-02-25 07:38:25 +00:00 committed by Glenn Y. Rolland
parent a18ec05996
commit d7030895ab
2 changed files with 32 additions and 26 deletions

View file

@ -189,7 +189,7 @@ void * msgAllocate(msgSpace *space,
// on mappe la totalité du pool // on mappe la totalité du pool
resultAddr = mmap( NULL, resultAddr = mmap( NULL,
bufferFreeSize, bufferFreeSize*bufferNb, /* bufferFreeSize*/
PROT_NONE, //prot PROT_READ | PROT_WRITE PROT_NONE, //prot PROT_READ | PROT_WRITE
MAP_SHARED, mSPoolFd, MAP_SHARED, mSPoolFd,
(off_t)0); (off_t)0);

View file

@ -1,39 +1,45 @@
#include "libnazgul.h" #include "libnazgul.h"
void * msgBufferMap(msgSpace * space, int poolIndex, int bufferIndex) { void * msgBufferMap(msgPoolData * poolDataTab, int poolIndex, int bufferIndex) {
void * resultAddr; void * resultAddr;
int msPoolFd, buffersize; int bufferSize, bufferNb;
int poolBufferTabFd;
msgBufferInfoTabId bufferInfoTabId; msgPoolId poolBufferTabId;
int bufferInfoTabFd;
// TODO: récuperer l'ID du BufferInfoTab; // TODO: récuperer l'ID du BufferInfoTab;
//strcpy(bufferInfoTabId, poolDataTabAddr[poolIndex].bufferInfoTabId); strcpy(poolBufferTabId, poolDataTab[poolIndex].poolId);
bufferSize=poolDataTab[poolIndex].bufferSize;
bufferNb=poolDataTab[poolIndex].bufferNb;
poolBufferTabFd=shm_open(poolBufferTabId,O_RDWR,SHM_DEFAULT_MODE);
bufferInfoTabFd=shm_open(bufferInfoTabId,O_RDWR,SHM_DEFAULT_MODE); if (poolBufferTabFd<0){
if (bufferInfoTabFd<0){ NZG_ERROR("shm_open",poolBufferTabId);
NZG_ERROR("sem_open",bufferInfoTabId);
goto ERROR;
}
if(bufferInfoTabFd == -1) {
NZG_ERROR("shm_open", bufferInfoTabId);
goto ERROR; goto ERROR;
} }
// mapper le buffer dans l'espace mémoire du processus // mapper le buffer dans l'espace mémoire du processus
resultAddr=mmap(NULL, buffersize, PROT_WRITE|PROT_READ, MAP_SHARED, msPoolFd, (off_t)0); /* on s'arrete juste derriere l'index qui nous intéresse */
resultAddr=mmap(NULL,
// TODO: poolDataTabId bufferSize*(bufferIndex+1),
PROT_NONE,
MAP_SHARED,
poolBufferTabFd,
(off_t)0);
if(resultAddr == MAP_FAILED) { if(resultAddr == MAP_FAILED) {
//NZG_ERROR("mmap", poolDataTabId); NZG_ERROR("mmap", poolBufferTabId);
goto ERROR; goto ERROR;
} }
close(msPoolFd); resultAddr=resultAddr +( bufferSize*bufferIndex);
mprotect(
resultAddr,
bufferSize,
PROT_READ|PROT_WRITE
);
close(poolBufferTabFd);
return resultAddr; return resultAddr;
ERROR: ERROR: