* munmap de l'addresse passée en parametre
This commit is contained in:
parent
ce5835b285
commit
913f0645f7
1 changed files with 10 additions and 5 deletions
15
src/free.c
15
src/free.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue