* munmap de l'addresse passée en parametre

This commit is contained in:
glenux 2004-02-23 22:16:44 +00:00 committed by Glenn Y. Rolland
parent 427b62dbbc
commit a87aa43265

View file

@ -61,6 +61,13 @@ sem_t * poolDataTabSemFd;
printf("Freing pool: %d, buffer: %d\n",poolIndex,bufferIndex);
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 */
munmap(poolDataTabAddr,(space->poolNb) * sizeof( msgPoolData ));
@ -75,14 +82,12 @@ sem_t * poolDataTabSemFd;
ressourceSemFd = sem_open(ressourceSemId,O_CREAT,SEM_DEFAULT_MODE,0);
if (ressourceSemFd == SEM_FAILED){
NZG_ERROR("sem_open",ressourceSemId);
return -1;
goto ERROR;
}
sem_post(ressourceSemFd);
sem_close(ressourceSemFd);
//sem_open ressource
//sem_post
//sem_close
return 0;
ERROR:
return -1;
}