*** empty log message ***

This commit is contained in:
glenux 2004-02-23 12:28:31 +00:00 committed by Glenn Y. Rolland
parent 8de2c8a6a5
commit 77a983c922
2 changed files with 21 additions and 14 deletions

View file

@ -37,14 +37,7 @@ 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,
O_RDWR,
@ -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,17 +187,21 @@ 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,
mSPoolDataTabAddr[selectedPoolIndex].bufferSize,
PROT_READ | PROT_WRITE,
MAP_SHARED, mSPoolFd, 0 );
//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);

View file

@ -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;