diff --git a/.gitmodules b/.gitmodules index ccbbc41..3059a39 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "shmalloc"] - path = shmalloc - url = https://github.com/MihirLuthra/shmalloc.git +[submodule "shm_alloc"] + path = shm_alloc + url = https://github.com/MihirLuthra/shm_alloc.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..abc886b --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +CC=clang + +CFLAGS= -D DEBUG_SHM=0 -I shm_alloc -Wall -D USE_SHARED_MEMORY -D DEBUG_DIR=\"debug\" -fsanitize=address + +ctrie_multiprocess_test.out: ctrie_multiprocess_test.c libctrie.so Makefile libshm_alloc.so + $(CC) $(CFLAGS) -o $@ ctrie_multiprocess_test.c -L. -lctrie -lshm_alloc + +libctrie.so: ctrie.c ctrie.h libshm_alloc.so + $(CC) $(CFLAGS) -fPIC -shared -o $@ ctrie.c -L. -Lshm_alloc -lc -lshm_alloc + +libshm_alloc.so: shm_alloc/shm_alloc.c shm_alloc/shm_alloc.h shm_alloc/shm_err.h libshm_util_funcs.so libshm_debug.so libshm_constants.so Makefile + $(CC) $(CFLAGS) -fPIC -shared -o $@ shm_alloc/shm_alloc.c -lc -L. -lshm_util_funcs -lshm_constants -lshm_debug + +libshm_debug.so: shm_alloc/shm_debug.h shm_alloc/shm_debug.c Makefile + $(CC) $(CFLAGS) -fPIC -shared -o $@ shm_alloc/shm_debug.c -lc + +libshm_util_funcs.so: shm_alloc/shm_util_funcs.h shm_alloc/shm_util_funcs.c libshm_constants.so libshm_debug.so shm_alloc/shm_types.h Makefile + $(CC) $(CFLAGS) -fPIC -shared -o $@ shm_alloc/shm_util_funcs.c -lc -L. -lshm_constants -lshm_debug + +libshm_constants.so: shm_alloc/shm_constants.h shm_alloc/shm_constants.c Makefile + $(CC) $(CFLAGS) -fPIC -shared -o $@ shm_alloc/shm_constants.c -lc + +clean: + rm *.so shm_file *.out .*.swp *.dbgfl diff --git a/ctrie.h b/ctrie.h index f9b269f..f729b9e 100644 --- a/ctrie.h +++ b/ctrie.h @@ -33,10 +33,10 @@ #include #if defined(USE_SHARED_MEMORY) -#include +#include -#define PTR(type) size_t -#define DEREF(ptr, output_type) (*((output_type*) (((char*) shm_base()) + ptr))) +#define PTR(type) shm_offt +#define DEREF(ptr, output_type) (*((output_type*) (((char*) get_shm_user_base()) + ptr))) #else /* defined(USE_SHARED_MEMORY) */ #define PTR(type) type* #define DEREF(ptr, output_type) (*((output_type*) ptr)) diff --git a/shm_alloc b/shm_alloc new file mode 160000 index 0000000..0e01b1c --- /dev/null +++ b/shm_alloc @@ -0,0 +1 @@ +Subproject commit 0e01b1ce9e13f8baedf94cdece6bf5140901728d diff --git a/shmalloc b/shmalloc deleted file mode 160000 index c7a4e73..0000000 --- a/shmalloc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c7a4e73e36b707124004489877c8a476b2bd6547