*** empty log message ***

This commit is contained in:
glenux 2004-02-23 23:19:04 +00:00
parent a07eced551
commit e42ccb6c9a
5 changed files with 20 additions and 34 deletions

View file

@ -5,7 +5,6 @@ int msgFree(msgSpace * space, void * addr){
int poolIndex;
int bufferIndex;
int poolDataTabFd;
msgPoolData * poolDataTabAddr;
sem_t * poolDataTabSemFd;
msgPoolDataTabSemId ressourceSemId;
@ -23,27 +22,7 @@ sem_t * poolDataTabSemFd;
/* verifier le premier arg du shm_open */
poolDataTabFd=shm_open(space->poolDataTabId,
O_RDWR,
MSGSPACE_DEFAULT_MODE);
if (poolDataTabFd == -1 ) {
fprintf( stderr, "Allocate %s failed: %s\n",
(char*)space->poolDataTabId,
strerror( errno ) );
return -1;
}
poolDataTabAddr = mmap( NULL, (space->poolNb) * sizeof( msgPoolData ),
PROT_READ | PROT_WRITE,
MAP_SHARED, poolDataTabFd, 0 );
if( poolDataTabAddr == MAP_FAILED) {
fprintf( stderr, "mmap failed: %s\n",
strerror( errno ) );
return -1;
}
poolDataTabAddr = msgPoolDataTabOpen(space);
// TODO: verouiller semaphore DataInfo
int err;
@ -68,10 +47,7 @@ sem_t * poolDataTabSemFd;
realAddr=realAddr-poolIndex*bufferSize;
munmap(realAddr,bufferSize*bufferNb);
/* unmapper le msgPoolDataTab */
munmap(poolDataTabAddr,(space->poolNb) * sizeof( msgPoolData ));
close(poolDataTabFd);
msgPoolDataTabClose(space,poolDataTabAddr);
// deverouiller semaphore DataInfo
sem_post(poolDataTabSemFd);

View file

@ -49,6 +49,7 @@ typedef struct MsgPoolData {
typedef struct MsgSpace {
msgSpaceId id;
msgSpaceId externId;
int poolNb;
int queueNb;
int pid;

View file

@ -29,14 +29,20 @@ int msgBufferInfoTabIdIntern(msgBufferInfoTabId dest, msgSpaceId src, int num);
int msgQueueSemIdIntern(msgQueueSemId dest, msgSpaceId externId, int queueIdx);
int msgQueueIdIntern(msgQueueId dest, msgSpaceId externId, int queueIdx);
int msgQueueElemIdIntern(msgQueueElemId dest, msgQueueId src, int counter);
int spaceListElemIdIntern(msgSpaceListElemId desc,msgSpaceId src);
/* list.c */
/* poolCreate.c */
int msgPoolCreate(msgSpaceId externId, int poolIdx, int buffNb, int buffSize);
/* poolDataTabClose.c */
int msgPoolDataTabClose(msgSpace *space, void *addr);
/* poolDataTabLock.c */
int msgPoolDataTabLock(msgSpace *space);
/* poolDataTabOpen.c */
void *msgPoolDataTabOpen(msgSpace *space);
/* poolDataTabUnlock.c */
/* poolDelete.c */
int msgPoolDelete(msgSpaceId spaceId, int poolIdx);
/* put.c */
int msgPut(msgSpace *space, int queueIndex, void *addr);
/* queueAdd.c */
int msgQueueElemAdd(msgQueue *queue, msgQueueElemId newElemId);
/* queueClose.c */
@ -57,6 +63,8 @@ msgQueue *queueInit(msgSpaceId externId, int queueIdx);
int queueLock(msgSpaceId externId, int queueIdx);
/* queueOpen.c */
void *msgQueueOpen(msgQueueId queueId);
/* queueRem.c */
int msgQueueElemRem(msgQueue *queue, msgQueueElemId oldElemId);
/* queueUnlock.c */
int queueUnlock(msgSpaceId externId, int queueIdx);
/* spaceCreate.c */
@ -65,7 +73,7 @@ msgSpace *msgSpaceCreate(msgSpaceId externId, int queueNb, int poolNb, msgPool *
int msgSpaceDelete(msgSpaceId externId);
/* spaceListAdd.c */
/* spaceListElemCreate.c */
int msgSpaceListElemCreate(msgSpaceListElemId resultName, msgSpaceId spaceId);
int msgSpaceListElemCreate(msgSpaceListElemId elemenListId, msgSpaceId spaceId);
/* spaceListElemLink.c */
/* spaceListInit.c */
int msgSpaceListInit(void);

View file

@ -19,7 +19,8 @@ int msgQueueElemAdd(msgQueue * queue, msgQueueElemId newElemId){
}
/* TODO: verifier si la liste n'est pas vide... */
if(queue->elemCounter < 1) {
if((strcmp(queue->headId,queue->id)==0)
&& (strcmp(queue->tailId,queue->id)==0)) {
NZG_ERROR("msgQueueAdd",queue->id);
goto ERROR;
}

View file

@ -28,8 +28,8 @@ msgQueue * queueInit(msgSpaceId externId, int queueIdx) {
/* on remplit la structure msgQueue */
queue->elemCounter = 0;
//queue->head = NULL;
//queue->tail = NULL;
strcpy(queue->head,queue->id);
strcpy(queue->tail,queue->id);