You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
4.1 KiB
127 lines
4.1 KiB
Index: src/Makefile |
|
--- src/Makefile.orig 2018-02-20 16:26:30.000000000 +0100 |
|
+++ src/Makefile 2018-03-18 12:01:37.990746000 +0100 |
|
@@ -2,31 +2,33 @@ |
|
# find the OS |
|
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
|
|
|
-CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc') |
|
-export CC |
|
+CC:=cc |
|
|
|
# if DEBUG env var is set, we compile with "debug" cflags |
|
-DEBUGFLAGS = -g -ggdb -O3 |
|
+DEBUGFLAGS = |
|
ifeq ($(DEBUG), 1) |
|
DEBUGFLAGS = -g -ggdb -O0 |
|
endif |
|
|
|
# Default CFLAGS |
|
-CFLAGS += -Wall -Wno-unused-function -Wno-unused-variable -Wno-unused-result -fPIC \ |
|
- -Werror=implicit-function-declaration \ |
|
+CFLAGS += -fPIC \ |
|
-D_GNU_SOURCE -std=gnu99 -I"$(shell pwd)" -DREDIS_MODULE_TARGET \ |
|
-DREDISMODULE_EXPERIMENTAL_API |
|
CFLAGS += $(DEBUGFLAGS) |
|
|
|
LINKER=$(CC) |
|
# Compile flags for non-osx / osx |
|
-ifneq ($(uname_S),Darwin) |
|
+ifeq ($(uname_S),Linux) |
|
SHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions -ldl -lpthread |
|
else |
|
+ifeq ($(uname_S),FreeBSD) |
|
+ SHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions -pthread |
|
+else |
|
LINKER = $(LD) |
|
CFLAGS += -mmacosx-version-min=10.6 |
|
SHOBJ_LDFLAGS ?= -macosx_version_min 10.6 -exported_symbol _RedisModule_OnLoad -bundle -undefined dynamic_lookup -ldl -lpthread |
|
endif |
|
+endif |
|
export CFLAGS |
|
|
|
|
|
Index: src/buffer.c |
|
--- src/buffer.c.orig 2018-02-20 16:26:30.000000000 +0100 |
|
+++ src/buffer.c 2018-03-18 12:01:37.990901000 +0100 |
|
@@ -1,3 +1,4 @@ |
|
+#include <sys/types.h> |
|
#include "buffer.h" |
|
#include "rmalloc.h" |
|
#include <assert.h> |
|
Index: src/concurrent_ctx.c |
|
--- src/concurrent_ctx.c.orig 2018-02-20 16:26:30.000000000 +0100 |
|
+++ src/concurrent_ctx.c 2018-03-18 12:03:02.202241000 +0100 |
|
@@ -48,7 +48,11 @@ |
|
/** Check the elapsed timer, and release the lock if enough time has passed */ |
|
int ConcurrentSearch_CheckTimer(ConcurrentSearchCtx *ctx) { |
|
static struct timespec now; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &now); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &now); |
|
+#endif |
|
|
|
long long durationNS = (long long)1000000000 * (now.tv_sec - ctx->lastTime.tv_sec) + |
|
(now.tv_nsec - ctx->lastTime.tv_nsec); |
|
@@ -70,7 +74,11 @@ |
|
} |
|
|
|
void ConcurrentSearchCtx_ResetClock(ConcurrentSearchCtx *ctx) { |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &ctx->lastTime); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &ctx->lastTime); |
|
+#endif |
|
ctx->ticker = 0; |
|
} |
|
|
|
@@ -153,4 +161,4 @@ |
|
ConcurrentSearch_CloseKeys(ctx); |
|
RedisModule_ThreadSafeContextUnlock(ctx->ctx); |
|
ctx->isLocked = 0; |
|
-} |
|
\ No newline at end of file |
|
+} |
|
Index: src/query.c |
|
--- src/query.c.orig 2018-02-20 16:26:30.000000000 +0100 |
|
+++ src/query.c 2018-03-18 12:03:44.579461000 +0100 |
|
@@ -910,7 +910,11 @@ |
|
if (RSGlobalConfig.queryTimeoutMS > 0) { |
|
// Check the elapsed processing time |
|
static struct timespec now; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &now); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &now); |
|
+#endif |
|
|
|
long long durationNS = (long long)1000000000 * (now.tv_sec - q->execCtx.startTime.tv_sec) + |
|
(now.tv_nsec - q->execCtx.startTime.tv_nsec); |
|
@@ -954,7 +958,11 @@ |
|
.state = QueryState_OK, |
|
.sctx = plan->ctx, |
|
.conc = plan->conc}; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &plan->execCtx.startTime); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &plan->execCtx.startTime); |
|
+#endif |
|
if (plan->conc) { |
|
ConcurrentSearchCtx_Init(req->sctx->redisCtx, plan->conc); |
|
ConcurrentSearch_AddKey(plan->conc, plan->ctx->key, REDISMODULE_READ, plan->ctx->keyName, |
|
Index: src/rmutil/sdsalloc.h |
|
--- src/rmutil/sdsalloc.h.orig 2018-02-20 16:26:30.000000000 +0100 |
|
+++ src/rmutil/sdsalloc.h 2018-03-18 12:04:27.237835000 +0100 |
|
@@ -36,11 +36,7 @@ |
|
* the include of your alternate allocator if needed (not needed in order |
|
* to use the default libc allocator). */ |
|
|
|
-#if defined(__MACH__) |
|
#include <stdlib.h> |
|
-#else |
|
-#include <malloc.h> |
|
-#endif |
|
//#include "zmalloc.h" |
|
#define s_malloc malloc |
|
#define s_realloc realloc
|
|
|