From 4496da13ed6db5eb5e823902e6aac90cc753a0f1 Mon Sep 17 00:00:00 2001 From: begasus Date: Thu, 8 Jun 2017 00:17:54 +0200 Subject: fix build diff --git a/deps/hiredis/net.c b/deps/hiredis/net.c index bdb84ce..8dc1586 100644 --- a/deps/hiredis/net.c +++ b/deps/hiredis/net.c @@ -138,7 +138,7 @@ int redisKeepAlive(redisContext *c, int interval) { return REDIS_ERR; } #else -#ifndef __sun +#if !defined(__sun) && !defined(__HAIKU__) val = interval; if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) { __redisSetError(c,REDIS_ERR_OTHER,strerror(errno)); diff --git a/src/Makefile b/src/Makefile index fdbe36a..a07a545 100644 --- a/src/Makefile +++ b/src/Makefile @@ -64,6 +64,11 @@ ifeq ($(uname_S),SunOS) FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6 FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt else +ifeq ($(uname_S),Haiku) + CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -Wall -W $(ARCH) $(PROF) + CCLINK?=-lroot -lnetwork + DEBUG?=-g -ggdb +else ifeq ($(uname_S),Darwin) # Darwin FINAL_LIBS+= -ldl @@ -89,6 +94,7 @@ endif endif endif endif +endif # Include paths to dependencies FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src diff --git a/src/aof.c b/src/aof.c index cbd906c..3d28b47 100644 --- a/src/aof.c +++ b/src/aof.c @@ -221,7 +221,7 @@ void stopAppendOnly(void) { serverLog(LL_NOTICE,"Killing running AOF rewrite child: %ld", (long) server.aof_child_pid); if (kill(server.aof_child_pid,SIGUSR1) != -1) { - while(wait3(&statloc,0,NULL) != server.aof_child_pid); + while(waitpid(&statloc,0,NULL) != server.aof_child_pid); } /* reset the buffer accumulating changes while the child saves */ aofRewriteBufferReset(); diff --git a/src/sentinel.c b/src/sentinel.c index 0168aa6..717d7e9 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -796,7 +796,7 @@ void sentinelCollectTerminatedScripts(void) { int statloc; pid_t pid; - while ((pid = wait3(&statloc,WNOHANG,NULL)) > 0) { + while ((pid = waitpid(&statloc,WNOHANG,NULL)) > 0) { int exitcode = WEXITSTATUS(statloc); int bysignal = 0; listNode *ln; @@ -808,7 +808,7 @@ void sentinelCollectTerminatedScripts(void) { ln = sentinelGetScriptListNodeByPid(pid); if (ln == NULL) { - serverLog(LL_WARNING,"wait3() returned a pid (%ld) we can't find in our scripts execution queue!", (long)pid); + serverLog(LL_WARNING,"waitpid() returned a pid (%ld) we can't find in our scripts execution queue!", (long)pid); continue; } sj = ln->value; diff --git a/src/server.c b/src/server.c index 609f396..09f246f 100644 --- a/src/server.c +++ b/src/server.c @@ -1185,14 +1185,14 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { int statloc; pid_t pid; - if ((pid = wait3(&statloc,WNOHANG,NULL)) != 0) { + if ((pid = waitpid(&statloc,WNOHANG,NULL)) != 0) { int exitcode = WEXITSTATUS(statloc); int bysignal = 0; if (WIFSIGNALED(statloc)) bysignal = WTERMSIG(statloc); if (pid == -1) { - serverLog(LL_WARNING,"wait3() returned an error: %s. " + serverLog(LL_WARNING,"waitpid() returned an error: %s. " "rdb_child_pid = %d, aof_child_pid = %d", strerror(errno), (int) server.rdb_child_pid, -- 2.7.0