*** empty log message ***

This commit is contained in:
glenux 2004-03-07 12:26:42 +00:00
parent 7c42f1cf47
commit 3d75566a88
15 changed files with 71 additions and 33 deletions

View file

@ -15,6 +15,7 @@ void * msgAllocate(msgSpace *space,
int option
){
void * resultAddr=NULL;
int bufferFreeSize;
int i;
msgPoolId resultPoolId;
/* tableau des valeurs des semPoolCoef/pool pour identifier le pool
@ -183,7 +184,6 @@ if (mSPoolDataTabAddr==NULL){
/* mapper le buffer libre dans l'esp addr du proc */
strcpy(resultPoolId,mSPoolDataTabAddr[selectedPoolIndex].poolId);
int bufferFreeSize;
bufferFreeSize=mSPoolDataTabAddr[selectedPoolIndex].bufferSize;
printf("BufferSize : %d\n", bufferFreeSize);

View file

@ -14,6 +14,7 @@ int msgBufferGetProcAttach(
bool found=false;
int pIdx=0;
int bIdx;
while ((!found) && (pIdx < poolNb)){
/* Pour chaque pool */
//récuperer l'ID du BufferInfoTab;
@ -29,7 +30,7 @@ int msgBufferGetProcAttach(
PROT_READ,MAP_SHARED,bufferInfoTabFd,(off_t)0);
/* on cherche dans chacun des buffers */
int bIdx=0;
bIdx=0;
while((!found) && bIdx<bufferInfoNb){
if (bufferInfoTabAddr[bIdx].addr == addr){
found=true;

View file

@ -1,13 +1,17 @@
#include "libnazgul.h"
int msgFree(msgSpace * space, void * addr){
printf("[ FREE 0x%08x ]\n",(int)addr);
int poolIndex;
int bufferIndex;
msgPoolData * poolDataTabAddr;
sem_t * ressourceSemFd;
msgPoolDataTabSemId ressourceSemId;
int err;
int bufferNb;
int bufferSize;
void * realAddr;
printf("[ FREE 0x%08x ]\n",(int)addr);
/* on acquiert le droit de modifier les infos sur la ressource */
/* on protege le tableau des associations */
if (msgPoolDataTabLock(space) <0){
@ -20,7 +24,6 @@ int msgFree(msgSpace * space, void * addr){
poolDataTabAddr = msgPoolDataTabOpen(space);
// TODO: verouiller semaphore DataInfo ??
int err;
poolIndex=-1; bufferIndex=-1;
err=msgBufferGetProcAttach(
@ -36,9 +39,9 @@ int msgFree(msgSpace * space, void * addr){
msgBufferDetachProc(poolDataTabAddr,poolIndex,bufferIndex,addr);
/* unmapper le buffer */
void * realAddr=addr;
int bufferSize=poolDataTabAddr[poolIndex].bufferSize;
int bufferNb=poolDataTabAddr[poolIndex].bufferNb;
realAddr=addr;
bufferSize=poolDataTabAddr[poolIndex].bufferSize;
bufferNb=poolDataTabAddr[poolIndex].bufferNb;
realAddr=realAddr-poolIndex*bufferSize;
munmap(realAddr,bufferSize*bufferNb);

View file

@ -8,6 +8,7 @@ void * msgGet(msgSpace * space,int queueIndex,int option){
msgQueue * queue;
msgQueueElemId oldElemId;
msgQueueElem * oldElem;
msgPoolData * poolDataTab;
// on teste la possibilité de lecture sur la liste...
if (option == NONBLOCK){
if (msgQueueReadTryLock(space->externId,queueIndex) <0){
@ -39,7 +40,6 @@ void * msgGet(msgSpace * space,int queueIndex,int option){
goto ERROR;
}
/* on récupere la taille des buffer dans la pool du buffer */
msgPoolData * poolDataTab;
poolDataTab=msgPoolDataTabOpen(space);
// mapper le buffer dans l'espace mémoire du processus
resultAddr=msgBufferMap(poolDataTab,oldElem->poolIndex,oldElem->bufferIndex);

View file

@ -26,6 +26,11 @@
#endif
#ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1)
#endif
#ifdef _NZG_REALFILEID
#define DEFAULT_MSGSPACELISTID "/tmp/nzgSpaceList"
#else

View file

@ -4,7 +4,9 @@
#define DEBUG 0
int msgPoolDataTabLock(msgSpace * space){
int semval;
sem_t * poolDataTabSemFd;
semval=0;
if (DEBUG) {printf("Locking %s\n",space->poolDataTabSemId);}
poolDataTabSemFd=sem_open(
@ -21,7 +23,7 @@ if (DEBUG) {printf("Locking %s\n",space->poolDataTabSemId);}
NZG_ERROR("sem_wait",space->poolDataTabSemId);
goto ERROR;
}
int semval=0;
sem_getvalue(poolDataTabSemFd,&semval);
if (DEBUG) { printf("(AfternValue:%d)\n",semval);}

View file

@ -4,6 +4,7 @@
#define DEBUG 0
int msgPoolDataTabUnlock(msgSpace * space){
int semval;
sem_t * poolDataTabSemFd;
if (DEBUG) { printf("Unlocking %s\n",space->poolDataTabSemId); }
poolDataTabSemFd=sem_open(
@ -20,7 +21,8 @@ int msgPoolDataTabUnlock(msgSpace * space){
NZG_ERROR("sem_post",space->poolDataTabSemId);
goto ERROR;
}
int semval=0;
semval=0;
sem_getvalue(poolDataTabSemFd,&semval);
if (DEBUG) { printf("(AfternValue:%d)\n",semval); }

View file

@ -8,6 +8,8 @@ int msgPut(msgSpace * space,int queueIndex, void * addr){
int err;
msgQueueElemId newElemId;
msgQueueElem * queueElem;
msgQueueId queueId;
msgQueue * queue;
msgPoolDataTabLock(space);
poolDataTabAddr=msgPoolDataTabOpen(space);
@ -24,8 +26,6 @@ int msgPut(msgSpace * space,int queueIndex, void * addr){
);
// ouvrir la queue avec le bon index
msgQueueId queueId;
msgQueue * queue;
msgQueueIdIntern(queueId,space->externId,queueIndex);
msgQueueProtLock(space->externId,queueIndex);

View file

@ -3,6 +3,8 @@
int msgQueueDelete(msgQueueId externId,int queueIdx){
msgQueue * queue;
msgQueueId queueId;
msgQueueSemId queueProtLockSemId;
msgQueueSemId queueReadLockSemId;
msgQueueIdIntern(queueId,externId,queueIdx);
queue = msgQueueOpen(queueId);
@ -15,8 +17,6 @@ int msgQueueDelete(msgQueueId externId,int queueIdx){
}
}
msgQueueSemId queueProtLockSemId;
msgQueueSemId queueReadLockSemId;
msgQueueProtSemIdIntern(queueProtLockSemId,externId,queueIdx);
msgQueueReadSemIdIntern(queueReadLockSemId,externId,queueIdx);
sem_unlink(queueProtLockSemId);

View file

@ -6,11 +6,11 @@ int msgQueueElemCreate(
msgQueueId queueId,
int counter){
msgQueueElemId queueElemId;
int queueElemFd;
msgQueueElemIdIntern(queueElemId,queueId,counter);
strcpy(finalQueueElemId,queueElemId);
int queueElemFd;
queueElemFd=shm_open(queueElemId,
O_RDWR|O_CREAT|O_EXCL|O_TRUNC,
SHM_DEFAULT_MODE);

View file

@ -24,21 +24,26 @@ CC=gcc
CFLAGS=-Wall -O2 -ggdb
#-O2 -ggdb
INCLUDES=-I /usr/include/ -I /usr/include/sys -I ../src/
INCLUDES=-I /usr/include/ -I ../src/
LIBINC=-L /usr/lib -L ../src
BASELIBS=-lnazgul
LIBS=$(BASELIBS)
DEFS=
ifeq "HP-UX" "${OS}"
DEFS=-D_NZG_HPUX
LIBS=$(BASELIBS) -lpthread -lrt
endif
ifeq "SunOS" "${OS}"
DEFS=-D_NZG_SUNOS
LIBS=$(BASELIBS) -lrt
endif
ifeq "Linux" "${OS}"
DEFS=-D_NZG_LINUX
LIBS=$(BASELIBS) -lrt -lpthread
endif
@ -61,7 +66,7 @@ clean:
@rm -f $(FILES)
% : %.c
$(CC) -o $* $< $(INCLUDES) $(LIBINC) $(LIBS) $(CFLAGS)
$(CC) -o $* $< $(INCLUDES) $(LIBINC) $(LIBS) $(CFLAGS) $(DEFS)
edit:
gvim *.h *.c

View file

@ -1,4 +1,9 @@
#ifdef _NZG_HPUX
#include <sys/wait.h>
#else
#include <wait.h>
#endif
#include "libnazgul.h"
int main(void) {
@ -20,7 +25,7 @@ int main(void) {
sprintf(testId,"test%d",(int)getuid());
printf("RequestedId: %s\n",testId);
printf("Void size: %d\n",sizeof(void));
printf("Void size: %d\n",(int)sizeof(void));
mSPAC=msgSpaceCreate(testId,0,3,poolInfos);
if (mSPAC ==NULL) {
NZG_ERROR("msgSpaceCreate",testId);

View file

@ -1,4 +1,9 @@
#ifdef _NZG_HPUX
#include <sys/wait.h>
#else
#include <wait.h>
#endif
#include "libnazgul.h"
void usage(char * myname){

View file

@ -1,4 +1,9 @@
#ifdef _NZG_HPUX
#include <sys/wait.h>
#else
#include <wait.h>
#endif
#include "libnazgul.h"
int main(void) {
@ -17,7 +22,7 @@ int main(void) {
sprintf(testId,"test%d",(int)getuid());
printf("RequestedId: %s\n",testId);
printf("Void size: %d\n",sizeof(void));
printf("Void size: %d\n",(int)sizeof(void));
//creation de l'espace de messages
mSPAC=msgSpaceCreate(testId,1,2,poolInfos);
if (mSPAC ==NULL) {

View file

@ -1,4 +1,9 @@
#ifdef _NZG_HPUX
#include <sys/wait.h>
#else
#include <wait.h>
#endif
#include "libnazgul.h"
int main(void) {
@ -17,7 +22,7 @@ int main(void) {
sprintf(testId,"test%d",(int)getuid());
printf("RequestedId: %s\n",testId);
printf("Void size: %d\n",sizeof(void));
printf("Void size: %d\n",(int)sizeof(void));
//creation de l'espace de messages
mSPAC=msgSpaceCreate(testId,1,2,poolInfos);
if (mSPAC ==NULL) {