* corrections et completions de fonctions

This commit is contained in:
glenux 2004-02-23 20:53:09 +00:00
parent 16287d957d
commit 682b23bcb0
7 changed files with 78 additions and 37 deletions

View file

@ -47,13 +47,13 @@ clean:
@$(CC) $(CFLAGS) -c $< $(INCLUDES) $(LIBINC) $(LIBS) $(DEFINES) -o $*.o @$(CC) $(CFLAGS) -c $< $(INCLUDES) $(LIBINC) $(LIBS) $(DEFINES) -o $*.o
protos: $(CFILES) protos: $(CFILES)
@rm -f nzg_proto.h @rm -f proto.h
@touch nzg_proto.h @touch proto.h
@( echo -e "#ifndef _NZG_PROTO"; \ @( echo -e "#ifndef _NZG_PROTO"; \
echo -e "#define _NZG_PROTO 1\n"; \ echo -e "#define _NZG_PROTO 1\n"; \
cproto *.c ; \ cproto *.c ; \
echo -e "\n#endif") > nzg_proto.t echo -e "\n#endif") > proto.t
@mv nzg_proto.t nzg_proto.h @mv proto.t proto.h
edit: edit:

View file

@ -69,6 +69,7 @@ typedef struct MsgSpaceList {
} msgSpaceList; } msgSpaceList;
typedef struct MsgQueueElem { typedef struct MsgQueueElem {
msgQueueElemId id;
int poolIndex; int poolIndex;
int bufferIndex; int bufferIndex;
msgQueueElemId next; msgQueueElemId next;

View file

@ -1,50 +1,73 @@
#ifndef _NZG_PROTO #ifndef _NZG_PROTO
#define _NZG_PROTO 1 #define _NZG_PROTO 1
/* nzg_allocate.c */ /* allocate.c */
void *msgAllocate(msgSpace *space, int pool, int taille, int option); void *msgAllocate(msgSpace *space, int pool, int taille, int option);
/* nzg_bufferAttachProc.c */ /* bufferAttachProc.c */
int msgBufferAttachProc(msgPoolData *poolDataTabAddr, int poolIndex, int bufferIndex, void *addr); int msgBufferAttachProc(msgPoolData *poolDataTabAddr, int poolIndex, int bufferIndex, void *addr);
/* nzg_buffer.c */ /* buffer.c */
int msgBufferGetAttachedProcIndex(msgPoolData *poolDataTabAddr, int poolIndex, void *addr); int msgBufferGetAttachedProcIndex(msgPoolData *poolDataTabAddr, int poolIndex, void *addr);
/* nzg_bufferDetachProc.c */ /* bufferDetachProc.c */
int msgBufferDetachProc(msgPoolData *poolDataTabAddr, int poolIndex, int bufferIndex, void *addr); int msgBufferDetachProc(msgPoolData *poolDataTabAddr, int poolIndex, int bufferIndex, void *addr);
/* nzg_bufferGetFreeIndex.c */ /* bufferGetFreeIndex.c */
int msgBufferGetFreeIndex(msgPoolData *poolDataTabAddr, int poolIndex); int msgBufferGetFreeIndex(msgPoolData *poolDataTabAddr, int poolIndex);
/* nzg_bufferInfoTabCreate.c */ /* bufferGetProcAttach.c */
int msgBufferGetProcAttach(msgPoolData *poolDataTabAddr, int poolNb, int *poolIndex, int *bufferIndex, void *addr);
/* bufferInfoTabCreate.c */
int msgBufferInfoTabCreate(msgSpaceId externId, msgPoolData *poolDataTabAddr, int poolIdx, int bufferNb); int msgBufferInfoTabCreate(msgSpaceId externId, msgPoolData *poolDataTabAddr, int poolIdx, int bufferNb);
/* nzg_bufferInfoTabInit.c */ /* bufferInfoTabInit.c */
int msgBufferInfoTabInit(msgPoolData *poolDataTabAddr, int poolIndex); int msgBufferInfoTabInit(msgPoolData *poolDataTabAddr, int poolIndex);
/* nzg_free.c */ /* free.c */
int msgFree(msgSpace *space, void *addr); int msgFree(msgSpace *space, void *addr);
/* nzg_ids.c */ /* ids.c */
int msgSpaceIdIntern(msgSpaceId dest, const msgSpaceId src); int msgSpaceIdIntern(msgSpaceId dest, const msgSpaceId src);
int msgPoolDataTabSemIdIntern(msgPoolSemId destSemId, const msgSpaceId externId);
int msgPoolSemIdIntern(msgPoolSemId destSemId, const msgSpaceId srcPoolId, int poolIdx); int msgPoolSemIdIntern(msgPoolSemId destSemId, const msgSpaceId srcPoolId, int poolIdx);
int msgPoolDataIdIntern(msgPoolDataTabId dest, const msgSpaceId src); int msgPoolDataIdIntern(msgPoolDataTabId dest, const msgSpaceId src);
int msgPoolIdIntern(msgPoolId dest, msgPoolId src, int num); int msgPoolIdIntern(msgPoolId dest, msgPoolId src, int num);
int msgBufferInfoTabIdIntern(msgBufferInfoTabId dest, msgSpaceId src, int num); int msgBufferInfoTabIdIntern(msgBufferInfoTabId dest, msgSpaceId src, int num);
/* nzg_list.c */ int msgQueueSemIdIntern(msgQueueSemId dest, msgSpaceId externId, int queueIdx);
/* nzg_msgList.c */ /* list.c */
/* poolCreate.c */
int msgPoolCreate(msgSpaceId externId, int poolIdx, int buffNb, int buffSize);
/* poolDelete.c */
int msgPoolDelete(msgSpaceId spaceId, int poolIdx);
/* queueAdd.c */
/* queueAddElem.c */
/* queueClose.c */
int msgQueueClose(msgQueue *queue);
/* queueDelete.c */
int msgQueueElemDelete(msgQueueElemId queueElemId);
/* queueElemClose.c */
int msgQueueElemClose(msgQueueElem *queueElem);
/* queueElemDelete.c */
int msgQueueElemDelete(msgQueueElemId queueElemId);
/* queueElemOpen.c */
void *msgQueueElemOpen(msgQueueElemId queueElemId);
/* queueInit.c */
/* queueLock.c */
int queueLock(msgSpaceId externId, int queueIdx);
/* queueOpen.c */
void *msgQueueOpen(msgQueueId queueId);
/* queueRemElem.c */
/* queueUnlock.c */
int queueUnlock(msgSpaceId externId, int queueIdx);
/* spaceCreate.c */
msgSpace *msgSpaceCreate(msgSpaceId externId, int queueNb, int poolNb, msgPool *poolInfos);
/* spaceDelete.c */
int msgSpaceDelete(msgSpaceId externId);
/* spaceListAdd.c */
/* spaceListElemCreate.c */
int msgSpaceListElemCreate(msgSpaceListElemId resultName, msgSpaceId spaceId);
/* spaceListElemLink.c */
/* spaceListInit.c */
int msgSpaceListInit(void); int msgSpaceListInit(void);
/* spaceListLocking.c */
int msgSpaceListLock(void); int msgSpaceListLock(void);
int msgSpaceListUnlock(void); int msgSpaceListUnlock(void);
int msgSpaceListElemCreate(msgSpaceListElemId resultName, msgSpaceId spaceId); /* spaceListRem.c */
/* nzg_poolCreate.c */ /* spaceOpen.c */
int msgPoolCreate(msgSpaceId externId, int poolIdx, int buffNb, int buffSize);
/* nzg_poolDelete.c */
int msgPoolDelete(msgSpaceId spaceId, int poolIdx);
/* nzg_spaceCreate.c */
msgSpace *msgSpaceCreate(msgSpaceId externId, int queueNb, int poolNb, msgPool *poolInfos);
/* nzg_spaceDelete.c */
int msgSpaceDelete(msgSpaceId externId);
/* nzg_spaceOpen.c */
msgSpace *msgSpaceOpen(msgSpaceId externId); msgSpace *msgSpaceOpen(msgSpaceId externId);
/* nzg_state.c */ /* state.c */
int msgBufferGetProcAttach(
msgPoolData * poolDataTabAddr,
int poolNb,
int * poolIndex,
int * bufferIndex,
void * addr
);
#endif #endif

View file

@ -1,7 +1,8 @@
#include "libnazgul.h" #include "libnazgul.h"
#include "ids.h" #include "ids.h"
#include "libnazgul.h"
int queueClose(msgQueue * queue){ int msgQueueClose(msgQueue * queue){
msgQueueId qId; msgQueueId qId;
strcpy(qId,queue->id); strcpy(qId,queue->id);

View file

@ -5,7 +5,14 @@ int msgQueueElemDelete(msgQueueElemId queueElemId){
msgQueueElemId nextIdToDie; msgQueueElemId nextIdToDie;
queueElemAddr = msgQueueElemOpen(queueElemId); queueElemAddr = msgQueueElemOpen(queueElemId);
msgQueueElemClose(queueElem); strcpy(nextIdToDie,queueElemAddr->id);
msgQueueElemClose(queueElemAddr);
if (shm_unlink(queueElemId) < 0){
NZG_ERROR("shm_unlink msgQueueElem",queueElemId);
goto ERROR;
}
if (nextIdToDie != NULL){ if (nextIdToDie != NULL){
return msgQueueElemDelete(nextIdToDie); return msgQueueElemDelete(nextIdToDie);
} else { } else {

View file

@ -5,7 +5,16 @@ int msgQueueElemDelete(msgQueueElemId queueElemId){
msgQueueElemId nextIdToDie; msgQueueElemId nextIdToDie;
queueElemAddr = msgQueueElemOpen(queueElemId); queueElemAddr = msgQueueElemOpen(queueElemId);
msgQueueElemClose(queueElem); if (queueElemAddr==NULL){
NZG_ERROR("msgQueueElemOpen",queueElemId);
goto ERROR;
}
if (msgQueueElemClose(queueElemAddr) < 0){
NZG_ERROR("msgQueueElemClose",queueElemId);
goto ERROR;
}
if (nextIdToDie != NULL){ if (nextIdToDie != NULL){
return msgQueueElemDelete(nextIdToDie); return msgQueueElemDelete(nextIdToDie);
} else { } else {

View file

@ -1,7 +1,7 @@
#include "libnazgul.h" #include "libnazgul.h"
#include "ids.h" #include "ids.h"
void * queueOpen(msgQueueId queueId){ void * msgQueueOpen(msgQueueId queueId){
int queueFd; int queueFd;
void * queueAddr; void * queueAddr;