*** empty log message ***

This commit is contained in:
glenux 2004-02-23 23:19:04 +00:00 committed by Glenn Y. Rolland
parent 552391bd76
commit 63e808c1e9
5 changed files with 20 additions and 34 deletions

View file

@ -5,7 +5,6 @@ int msgFree(msgSpace * space, void * addr){
int poolIndex; int poolIndex;
int bufferIndex; int bufferIndex;
int poolDataTabFd;
msgPoolData * poolDataTabAddr; msgPoolData * poolDataTabAddr;
sem_t * poolDataTabSemFd; sem_t * poolDataTabSemFd;
msgPoolDataTabSemId ressourceSemId; msgPoolDataTabSemId ressourceSemId;
@ -23,27 +22,7 @@ sem_t * poolDataTabSemFd;
/* verifier le premier arg du shm_open */ /* verifier le premier arg du shm_open */
poolDataTabFd=shm_open(space->poolDataTabId, poolDataTabAddr = msgPoolDataTabOpen(space);
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;
}
// TODO: verouiller semaphore DataInfo // TODO: verouiller semaphore DataInfo
int err; int err;
@ -68,10 +47,7 @@ sem_t * poolDataTabSemFd;
realAddr=realAddr-poolIndex*bufferSize; realAddr=realAddr-poolIndex*bufferSize;
munmap(realAddr,bufferSize*bufferNb); munmap(realAddr,bufferSize*bufferNb);
/* unmapper le msgPoolDataTab */ msgPoolDataTabClose(space,poolDataTabAddr);
munmap(poolDataTabAddr,(space->poolNb) * sizeof( msgPoolData ));
close(poolDataTabFd);
// deverouiller semaphore DataInfo // deverouiller semaphore DataInfo
sem_post(poolDataTabSemFd); sem_post(poolDataTabSemFd);

View file

@ -49,6 +49,7 @@ typedef struct MsgPoolData {
typedef struct MsgSpace { typedef struct MsgSpace {
msgSpaceId id; msgSpaceId id;
msgSpaceId externId;
int poolNb; int poolNb;
int queueNb; int queueNb;
int pid; 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 msgQueueSemIdIntern(msgQueueSemId dest, msgSpaceId externId, int queueIdx);
int msgQueueIdIntern(msgQueueId dest, msgSpaceId externId, int queueIdx); int msgQueueIdIntern(msgQueueId dest, msgSpaceId externId, int queueIdx);
int msgQueueElemIdIntern(msgQueueElemId dest, msgQueueId src, int counter); int msgQueueElemIdIntern(msgQueueElemId dest, msgQueueId src, int counter);
int spaceListElemIdIntern(msgSpaceListElemId desc,msgSpaceId src);
/* list.c */ /* list.c */
/* poolCreate.c */ /* poolCreate.c */
int msgPoolCreate(msgSpaceId externId, int poolIdx, int buffNb, int buffSize); 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 */ /* poolDelete.c */
int msgPoolDelete(msgSpaceId spaceId, int poolIdx); int msgPoolDelete(msgSpaceId spaceId, int poolIdx);
/* put.c */
int msgPut(msgSpace *space, int queueIndex, void *addr);
/* queueAdd.c */ /* queueAdd.c */
int msgQueueElemAdd(msgQueue *queue, msgQueueElemId newElemId); int msgQueueElemAdd(msgQueue *queue, msgQueueElemId newElemId);
/* queueClose.c */ /* queueClose.c */
@ -57,6 +63,8 @@ msgQueue *queueInit(msgSpaceId externId, int queueIdx);
int queueLock(msgSpaceId externId, int queueIdx); int queueLock(msgSpaceId externId, int queueIdx);
/* queueOpen.c */ /* queueOpen.c */
void *msgQueueOpen(msgQueueId queueId); void *msgQueueOpen(msgQueueId queueId);
/* queueRem.c */
int msgQueueElemRem(msgQueue *queue, msgQueueElemId oldElemId);
/* queueUnlock.c */ /* queueUnlock.c */
int queueUnlock(msgSpaceId externId, int queueIdx); int queueUnlock(msgSpaceId externId, int queueIdx);
/* spaceCreate.c */ /* spaceCreate.c */
@ -65,7 +73,7 @@ msgSpace *msgSpaceCreate(msgSpaceId externId, int queueNb, int poolNb, msgPool *
int msgSpaceDelete(msgSpaceId externId); int msgSpaceDelete(msgSpaceId externId);
/* spaceListAdd.c */ /* spaceListAdd.c */
/* spaceListElemCreate.c */ /* spaceListElemCreate.c */
int msgSpaceListElemCreate(msgSpaceListElemId resultName, msgSpaceId spaceId); int msgSpaceListElemCreate(msgSpaceListElemId elemenListId, msgSpaceId spaceId);
/* spaceListElemLink.c */ /* spaceListElemLink.c */
/* spaceListInit.c */ /* spaceListInit.c */
int msgSpaceListInit(void); int msgSpaceListInit(void);

View file

@ -19,7 +19,8 @@ int msgQueueElemAdd(msgQueue * queue, msgQueueElemId newElemId){
} }
/* TODO: verifier si la liste n'est pas vide... */ /* 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); NZG_ERROR("msgQueueAdd",queue->id);
goto ERROR; goto ERROR;
} }

View file

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