* renommage
This commit is contained in:
parent
e8503824f6
commit
cbb563621d
2 changed files with 41 additions and 0 deletions
8
src/nzg_bufferInfoTabCreate.c
Normal file
8
src/nzg_bufferInfoTabCreate.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
int msgBufferInfoTabCreate(
|
||||
msgSpaceId externId,
|
||||
int poolIdx,
|
||||
int buffNb) {
|
||||
|
||||
bufferInfoTabInit(poolIdx);
|
||||
return -1;
|
||||
}
|
33
src/nzg_bufferInfoTabInit.c
Normal file
33
src/nzg_bufferInfoTabInit.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "libnazgul.h"
|
||||
|
||||
int msgBufferInit(msgPoolData * poolDataTabAddr,int poolIndex){
|
||||
msgBufferInfoTabId bufferInfoTabId;
|
||||
int bufferInfoTabFd;
|
||||
msgBufferInfo * bufferInfoTabAddr;
|
||||
int bufferInfoNb;
|
||||
|
||||
//récuperer l'ID du BufferInfoTab;
|
||||
strcpy(bufferInfoTabId, poolDataTabAddr[poolIndex].bufferInfoTabId);
|
||||
|
||||
bufferInfoTabFd=shm_open(bufferInfoTabId,O_RDWR,SHM_DEFAULT_MODE);
|
||||
if (bufferInfoTabFd<0){
|
||||
perror("shm_open");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** on regarde dans le tableau d'infos de buffer **/
|
||||
bufferInfoNb=poolDataTabAddr[poolIndex].bufferNb;
|
||||
bufferInfoTabAddr=mmap(NULL,bufferInfoNb*sizeof(msgBufferInfo),
|
||||
PROT_READ,MAP_SHARED,bufferInfoTabFd,(off_t)0);
|
||||
|
||||
int i;
|
||||
for (i=0;i<bufferInfoNb;i++){
|
||||
bufferInfoTabAddr[i].ownerPid = (pid_t)-1;
|
||||
}
|
||||
|
||||
if (munmap(bufferInfoTabAddr,bufferInfoNb*sizeof(msgBufferInfo))< 0)
|
||||
{ perror("munmap"); return -1; }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in a new issue