*** empty log message ***
This commit is contained in:
parent
e8799963df
commit
3909693db4
2 changed files with 21 additions and 14 deletions
|
@ -37,13 +37,6 @@ void * msgAllocate(msgSpace *space,
|
|||
selectedPoolIndex=-1;
|
||||
|
||||
|
||||
poolDataTabSemFd=sem_open(space->poolDataTabSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
||||
if (poolDataTabSemFd == SEM_FAILED){
|
||||
NZG_ERROR("sem_open : ouverture de la ressource",
|
||||
space->poolDataTabSemId);
|
||||
return NULL;
|
||||
}
|
||||
sem_wait(poolDataTabSemFd);
|
||||
|
||||
/* TODO: verifier le premier arg du shm_open */
|
||||
mSPoolDataTabFd=shm_open(space->poolDataTabId,
|
||||
|
@ -171,7 +164,15 @@ void * msgAllocate(msgSpace *space,
|
|||
|
||||
/* on a acqui un semaphore pour la ressouce */
|
||||
/* on acquiert le droit de modifier les infos sur la ressource */
|
||||
//sem_wait(poolDataTabSemFd);
|
||||
/* on protege le tableau des associations */
|
||||
poolDataTabSemFd=sem_open(space->poolDataTabSemId,
|
||||
O_CREAT,SEM_DEFAULT_MODE,1);
|
||||
if (poolDataTabSemFd == SEM_FAILED){
|
||||
NZG_ERROR("sem_open : ouverture de la ressource",
|
||||
space->poolDataTabSemId);
|
||||
return NULL;
|
||||
}
|
||||
sem_wait(poolDataTabSemFd);
|
||||
|
||||
/* on modifie maintenant les données */
|
||||
/* - on récupere l'index du premier buffer libre */
|
||||
|
@ -186,6 +187,7 @@ void * msgAllocate(msgSpace *space,
|
|||
/* mapper le buffer libre dans l'esp addr du proc */
|
||||
strcpy(resultPoolId,mSPoolDataTabAddr[selectedPoolIndex].poolId);
|
||||
|
||||
|
||||
mSPoolFd=shm_open(resultPoolId,O_RDWR,MSGSPACE_DEFAULT_MODE);
|
||||
|
||||
resultAddr = mmap( 0,
|
||||
|
@ -195,8 +197,11 @@ void * msgAllocate(msgSpace *space,
|
|||
|
||||
//TODO:
|
||||
/* - on s'enregistre aupres de ce buffer */
|
||||
//msgBufferAttachProc(mSPoolDataTabFd,selectedPoolIndex,resultAddr);
|
||||
|
||||
msgBufferAttachProc(mSPoolDataTabAddr,
|
||||
selectedPoolIndex,
|
||||
bufferFreeIndex,
|
||||
resultAddr);
|
||||
close(mSPoolFd);
|
||||
|
||||
sem_post(poolDataTabSemFd);
|
||||
sem_close(poolDataTabSemFd);
|
||||
|
|
|
@ -14,6 +14,7 @@ int msgBufferAttachProc(
|
|||
//récuperer l'ID du BufferInfoTab;
|
||||
strcpy(bufferInfoTabId, poolDataTabAddr[poolIndex].bufferInfoTabId);
|
||||
|
||||
|
||||
bufferInfoTabFd=shm_open(bufferInfoTabId,O_RDWR,SHM_DEFAULT_MODE);
|
||||
if (bufferInfoTabFd<0){
|
||||
NZG_ERROR("sem_open",bufferInfoTabId);
|
||||
|
@ -23,7 +24,8 @@ int msgBufferAttachProc(
|
|||
/** 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);
|
||||
PROT_READ|PROT_WRITE,MAP_SHARED,bufferInfoTabFd,(off_t)0);
|
||||
printf("atta gooo %s\n",bufferInfoTabId);
|
||||
|
||||
bufferInfoTabAddr[bufferIndex].ownerPid = getpid();
|
||||
bufferInfoTabAddr[bufferIndex].addr = addr;
|
||||
|
|
Loading…
Reference in a new issue