*** 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
resultAddr = mmap( NULL,
bufferFreeSize,
bufferFreeSize*bufferNb, /* bufferFreeSize*/
PROT_NONE, //prot PROT_READ | PROT_WRITE
MAP_SHARED, mSPoolFd,
(off_t)0);

View file

@ -1,39 +1,45 @@
#include "libnazgul.h"
void * msgBufferMap(msgSpace * space, int poolIndex, int bufferIndex) {
void * msgBufferMap(msgPoolData * poolDataTab, int poolIndex, int bufferIndex) {
void * resultAddr;
int msPoolFd, buffersize;
msgBufferInfoTabId bufferInfoTabId;
int bufferInfoTabFd;
int bufferSize, bufferNb;
int poolBufferTabFd;
msgPoolId poolBufferTabId;
// 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;
bufferInfoTabFd=shm_open(bufferInfoTabId,O_RDWR,SHM_DEFAULT_MODE);
if (bufferInfoTabFd<0){
NZG_ERROR("sem_open",bufferInfoTabId);
goto ERROR;
}
if(bufferInfoTabFd == -1) {
NZG_ERROR("shm_open", bufferInfoTabId);
poolBufferTabFd=shm_open(poolBufferTabId,O_RDWR,SHM_DEFAULT_MODE);
if (poolBufferTabFd<0){
NZG_ERROR("shm_open",poolBufferTabId);
goto ERROR;
}
// mapper le buffer dans l'espace mémoire du processus
resultAddr=mmap(NULL, buffersize, PROT_WRITE|PROT_READ, MAP_SHARED, msPoolFd, (off_t)0);
// TODO: poolDataTabId
/* 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", poolDataTabId);
NZG_ERROR("mmap", poolBufferTabId);
goto ERROR;
}
close(msPoolFd);
resultAddr=resultAddr +( bufferSize*bufferIndex);
mprotect(
resultAddr,
bufferSize,
PROT_READ|PROT_WRITE
);
close(poolBufferTabFd);
return resultAddr;
ERROR: