*** empty log message ***

This commit is contained in:
glenux 2004-02-23 17:28:46 +00:00 committed by Glenn Y. Rolland
parent 27b4accdd9
commit 639a56ac4b
2 changed files with 53 additions and 1 deletions

View file

@ -203,8 +203,10 @@ void * msgAllocate(msgSpace *space,
mprotect(resultAddr,bufferFreeSize*bufferNb,PROT_NONE);
mprotect(resultAddr,bufferFreeSize*(bufferFreeIndex+1),PROT_READ|PROT_WRITE);
mprotect(resultAddr,bufferFreeSize*bufferFreeIndex,PROT_NONE);
resultAddr=resultAddr +( bufferFreeSize*bufferFreeIndex);
strcpy(resultAddr,"a");
//(bufferFreeSize*bufferFreeIndex) );
if( resultAddr == MAP_FAILED) {
NZG_ERROR("resultAddr mmap","");
goto ERROR;

View file

@ -0,0 +1,50 @@
#include "libnazgul.h"
int msgBufferGetProcAttach(
msgPoolData * poolDataTabAddr,
int poolNb,
int * poolIndex,
int * bufferIndex,
void * addr
){
msgBufferInfoTabId bufferInfoTabId;
int bufferInfoTabFd;
msgBufferInfo * bufferInfoTabAddr;
int bufferInfoNb;
bool found=false;
int pIdx=0;
while ((!found) && (pIdx < poolNb)){
/* Pour chaque pool */
//récuperer l'ID du BufferInfoTab;
strcpy(bufferInfoTabId, poolDataTabAddr[pIdx].bufferInfoTabId);
bufferInfoNb=poolDataTabAddr[pIdx].bufferNb;
bufferInfoTabFd=shm_open(bufferInfoTabId,O_RDWR,SHM_DEFAULT_MODE);
if (bufferInfoTabFd<0)
{ NZG_ERROR("shm_open",bufferInfoTabId); return -1; }
/** on regarde dans le tableau d'infos de buffer **/
bufferInfoTabAddr=mmap(NULL,bufferInfoNb*sizeof(msgBufferInfo),
PROT_READ,MAP_SHARED,bufferInfoTabFd,(off_t)0);
/* on cherche dans chacun des buffers */
int bIdx=0;
while((!found) && bIdx<bufferInfoNb){
if (bufferInfoTabAddr[bIdx].addr == addr){
found=true;
(*bufferIndex)=bIdx;
};
bIdx++;
}
if (found){ (*poolIndex)=pIdx; }
/* on détache le morceau de mémoire */
if (munmap(bufferInfoTabAddr,bufferInfoNb*sizeof(msgBufferInfo))< 0)
{ NZG_ERROR("munmap",bufferInfoTabId); return -1; }
close(bufferInfoTabFd);
pIdx++;
}
if (found){ return 0; } else {return -1;}
}