diff --git a/src/Makefile b/src/Makefile index 1308a34..0ba3d4e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,9 +7,9 @@ #LIBS= CC=gcc -CFLAGS=-ggdb -O2 -Wall -USER_CLASSPATH:=../bin:../lib -JFLAGS=-d ../bin -g -deprecation +CFLAGS=-ggdb -Wall +#-O2 +#LIBS=-lrt #-verbose PRJNAME=Libnazgul GDATE := $(shell date +"-%Y-%m-%d_r%H") @@ -32,5 +32,5 @@ clean: @rm -f *.o %.o : %.c - $(CC) $(CFLAGS) $(INCLUDES) $(LIBINC) $(LIBS) -c $< -o $*.o + $(CC) $(CFLAGS) -c $< $(INCLUDES) $(LIBINC) $(LIBS) -o $*.o diff --git a/src/nzg_create.c b/src/nzg_create.c index 67120dd..d065184 100644 --- a/src/nzg_create.c +++ b/src/nzg_create.c @@ -1,12 +1,8 @@ -#include /* POSIX et al */ -#include -#include -#include -#include /* pour O_RDWR */ -#include -#include /* shm_open */ +#include "nzg_global.h" #include "nzg_iface.h" #include "nzg_proto.h" +#include +#include /* * spaceId : identifiant externe de l'espace de msg @@ -57,7 +53,7 @@ msgSpace * msgSpaceOpen(msgSpaceId spaceId){ } void msgSpaceDelete(msgSpaceId spaceId){ - int shmId; + //int shmId; msgSpaceId nzgId=msgSp2nzgId(spaceId); int er; if ((er=shm_unlink(nzgId))<0){ diff --git a/src/nzg_global.h b/src/nzg_global.h index 2a5f0e4..158818e 100644 --- a/src/nzg_global.h +++ b/src/nzg_global.h @@ -1,3 +1,9 @@ -#include +#include /* POSIX et al */ +#include +#include +#include +#include /* pour O_RDWR */ +#include +#include /* shm_open */ #define PAGESIZE sysconf(_SC_PAGESIZE) diff --git a/src/nzg_proto.h b/src/nzg_proto.h index 1acd116..13eba55 100644 --- a/src/nzg_proto.h +++ b/src/nzg_proto.h @@ -1,13 +1,6 @@ char **msgSpaceIdList(void); -msgSpace * msgSpaceCreate( - msgSpaceId spaceId, // identifiant externe de l'espace de msg - int queueNb, // nombre de files de messages - int poolNb, // nombre de pool de buffers - msgPool * queueNbCar // tableau de caracteristiques des different pool - ); - void * msgAllocate( msgSpace * space, //espace de message concerné int pool, //numéro de pool ou réaliser l'allocation @@ -17,7 +10,10 @@ void * msgAllocate( /* nzg_create.c */ -msgSpace *msgSpaceCreate(msgSpaceId spaceId, int queueNb, int poolNb, msgPool *queueNbCar); +msgSpace *msgSpaceCreate( + msgSpaceId spaceId, int queueNb, int poolNb, msgPool *queueNbCar + ); + msgSpace *msgSpaceOpen(msgSpaceId spaceId); void msgSpaceDelete(msgSpaceId spaceId); msgSpaceId msgSp2nzgId(msgSpaceId spaceId); diff --git a/test/Makefile b/test/Makefile index bb221ff..6d682c4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -7,19 +7,16 @@ #LIBS= CC=gcc -CFLAGS=-ggdb -O2 -Wall -INCLUDES=-I../src -LIBINC=-L../src -LIBS=-lnazgul +CFLAGS=-Wall --static +#-O2 -ggdb +INCLUDES=-I ../src/ +LIBINC=-L ../src +LIBS=-lnazgul -lrt -USER_CLASSPATH:=../bin:../lib -JFLAGS=-d ../bin -g -deprecation -#-verbose PRJNAME=Libnazgul GDATE := $(shell date +"-%Y-%m-%d_r%H") GFILENAME := ../$(PRJNAME)$(GDATE).tar.bz2 LOCALDIR = $(shell pwd) -BINDIR=../bin CFILES := $(shell ls *.c) #OFILES := $(patsubst %.c,%.o,$(CFILES)) FILES := $(patsubst %.c,%,$(CFILES)) @@ -35,5 +32,5 @@ clean: @rm -f $(FILES) % : %.c - $(CC) $(CFLAGS) $(INCLUDES) $(LIBINC) $(LIBS) $< -o $* + $(CC) $(CFLAGS) $< -o $* $(INCLUDES) $(LIBINC) $(LIBS) diff --git a/test/create_delete.c b/test/create_delete.c index 13a2c23..3dd62f3 100644 --- a/test/create_delete.c +++ b/test/create_delete.c @@ -1,8 +1,12 @@ +#include "nzg_global.h" #include "nzg_iface.h" #include "nzg_proto.h" int main(void) { - // msgSpaceId mSID=msgSpaceIdGet(""); //renvoie un ID propre au programme // msgSpace mS=0; + msgSpaceId testId=(msgSpaceId)"test"; + //msgSpace * mSPAC=msgSpaceCreate(testId,0,0,NULL); + msgSpaceDelete(testId); + return 0; }