diff --git a/src/Makefile_wasm b/src/Makefile_wasm index c22a8ca1..312eaaba 100644 --- a/src/Makefile_wasm +++ b/src/Makefile_wasm @@ -4,7 +4,7 @@ SYSROOT = /opt/wasi-sdk/share/wasi-sysroot TARGET_TRIPLE = wasm32-unknown-wasi CFLAGS = -nostartfiles -fvisibility=hidden LDFLAGS = -Wl,--no-entry,--demangle,--allow-undefined -EXPORT_FUNCS = --export=allocate,--export=deallocate,--export=invoke,--export=load,--export=store +EXPORT_FUNCS = --export=allocate,--export=deallocate,--export=invoke,--export=load,--export=store,--export=redis_allocate,--export=redis_deallocate,--export=redis_invoke,--export=redis_load,--export=redis_store WRAPPER_SRC = wrapper.c LUA =/code/deps/lua/src REDIS_SERVER = adlist.c quicklist.c debug.c dict.c server.c sds.c zmalloc.c lzf_c.c lzf_d.c pqsort.c zipmap.c sha1.c ziplist.c release.c networking.c util.c object.c db.c t_string.c t_list.c t_set.c t_zset.c t_hash.c multi.c sort.c intset.c crc16.c endianconv.c slowlog.c scripting.c rand.c crc64.c bitops.c notify.c hyperloglog.c latency.c sparkline.c geo.c evict.c expire.c geohash.c geohash_helper.c defrag.c siphash.c rax.c t_stream.c listpack.c lolwut.c lolwut5.c ../deps/lua/src/*.c diff --git a/src/wrapper.c b/src/wrapper.c index a710ca30..da169125 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -21,18 +21,34 @@ void* allocate(size_t size) { return zmalloc(size + 1); } +void* redis_allocate(size_t size) { + return allocate(size); +} + void deallocate(void *ptr, int size) { zfree(ptr); } +void redis_deallocate(void *ptr, int size) { + deallocate(ptr, size); +} + void store(char *ptr, unsigned char byte) { *ptr = byte; } +void redis_store(char *ptr, unsigned char byte) { + store(ptr, byte); +} + unsigned char load(const unsigned char *ptr) { return *ptr; } +unsigned char redis_load(const unsigned char *ptr) { + return load(ptr); +} + // Cleans client output buffers to - client is blocked and // doesn't receive requests until output buffer isn't empty. void clean_client_buffer(client *c) { @@ -129,3 +145,7 @@ const char *invoke(char *request, int request_size) { return response; } + +const char *redis_invoke(char *request, int request_size) { + return invoke(request, request_size); +}