* munmap de l'addresse passée en parametre

This commit is contained in:
glenux 2004-02-23 22:16:44 +00:00
parent ce5835b285
commit 913f0645f7

View file

@ -61,6 +61,13 @@ sem_t * poolDataTabSemFd;
printf("Freing pool: %d, buffer: %d\n",poolIndex,bufferIndex); printf("Freing pool: %d, buffer: %d\n",poolIndex,bufferIndex);
msgBufferDetachProc(poolDataTabAddr,poolIndex,bufferIndex,addr); msgBufferDetachProc(poolDataTabAddr,poolIndex,bufferIndex,addr);
/* unmapper le buffer */
void * realAddr=addr;
int bufferSize=poolDataTabAddr[poolIndex].bufferSize;
int bufferNb=poolDataTabAddr[poolIndex].bufferNb;
realAddr=realAddr-poolIndex*bufferSize;
munmap(realAddr,bufferSize*bufferNb);
/* unmapper le msgPoolDataTab */ /* unmapper le msgPoolDataTab */
munmap(poolDataTabAddr,(space->poolNb) * sizeof( msgPoolData )); munmap(poolDataTabAddr,(space->poolNb) * sizeof( msgPoolData ));
@ -75,14 +82,12 @@ sem_t * poolDataTabSemFd;
ressourceSemFd = sem_open(ressourceSemId,O_CREAT,SEM_DEFAULT_MODE,0); ressourceSemFd = sem_open(ressourceSemId,O_CREAT,SEM_DEFAULT_MODE,0);
if (ressourceSemFd == SEM_FAILED){ if (ressourceSemFd == SEM_FAILED){
NZG_ERROR("sem_open",ressourceSemId); NZG_ERROR("sem_open",ressourceSemId);
return -1; goto ERROR;
} }
sem_post(ressourceSemFd); sem_post(ressourceSemFd);
sem_close(ressourceSemFd); sem_close(ressourceSemFd);
//sem_open ressource
//sem_post
//sem_close
return 0; return 0;
ERROR:
return -1;
} }