Several (mostly Solaris-related) cleanups (#8171)

* Allow runtest-moduleapi use a different 'make', for systems where GNU Make is 'gmake'.
* Fix issue with builds on Solaris re-building everything from scratch due to CFLAGS/LDFLAGS not stored.
* Fix compile failure on Solaris due to atomicvar and a bunch of warnings.
* Fix garbled log timestamps on Solaris.
This commit is contained in:
Yossi Gottlieb 2020-12-13 17:09:54 +02:00 committed by GitHub
parent f74c32cad2
commit 86e3395c11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 32 additions and 32 deletions

View File

@ -1,6 +1,7 @@
#!/bin/sh
TCL_VERSIONS="8.5 8.6"
TCLSH=""
[ -z "$MAKE" ] && MAKE=make
for VERSION in $TCL_VERSIONS; do
TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL
@ -12,7 +13,7 @@ then
exit 1
fi
make -C tests/modules && \
$MAKE -C tests/modules && \
$TCLSH tests/test_helper.tcl \
--single unit/moduleapi/commandfilter \
--single unit/moduleapi/fork \

View File

@ -99,9 +99,11 @@ endif
ifeq ($(uname_S),SunOS)
# SunOS
ifneq ($(@@),32bit)
CFLAGS+= -m64
LDFLAGS+= -m64
ifeq ($(findstring -m32,$(FINAL_CFLAGS)),)
CFLAGS+=-m64
endif
ifeq ($(findstring -m32,$(FINAL_LDFLAGS)),)
LDFLAGS+=-m64
endif
DEBUG=-g
DEBUG_FLAGS=-g

View File

@ -67,7 +67,7 @@ static int evport_debug = 0;
typedef struct aeApiState {
int portfd; /* event port */
int npending; /* # of pending fds */
uint_t npending; /* # of pending fds */
int pending_fds[MAX_EVENT_BATCHSZ]; /* pending fds */
int pending_masks[MAX_EVENT_BATCHSZ]; /* pending fds' masks */
} aeApiState;
@ -95,6 +95,8 @@ static int aeApiCreate(aeEventLoop *eventLoop) {
}
static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
(void) eventLoop;
(void) setsize;
/* Nothing to resize here. */
return 0;
}
@ -107,7 +109,7 @@ static void aeApiFree(aeEventLoop *eventLoop) {
}
static int aeApiLookupPending(aeApiState *state, int fd) {
int i;
uint_t i;
for (i = 0; i < state->npending; i++) {
if (state->pending_fds[i] == fd)
@ -243,7 +245,7 @@ static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int mask) {
static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
aeApiState *state = eventLoop->apidata;
struct timespec timeout, *tsp;
int mask, i;
uint_t mask, i;
uint_t nevents;
port_event_t event[MAX_EVENT_BATCHSZ];

View File

@ -1728,7 +1728,7 @@ int rewriteAppendOnlyFileBackground(void) {
return C_ERR;
}
serverLog(LL_NOTICE,
"Background append only file rewriting started by pid %d",childpid);
"Background append only file rewriting started by pid %ld",(long) childpid);
server.aof_rewrite_scheduled = 0;
server.aof_rewrite_time_start = time(NULL);
server.aof_child_pid = childpid;

View File

@ -105,7 +105,7 @@
atomic_store_explicit(&var,value,memory_order_seq_cst)
#define REDIS_ATOMIC_API "c11-builtin"
#elif !defined(__ATOMIC_VAR_FORCE_SYNC_MACROS) && !defined(__sun) && \
#elif !defined(__ATOMIC_VAR_FORCE_SYNC_MACROS) && \
(!defined(__clang__) || !defined(__APPLE__) || __apple_build_version__ > 4210057) && \
defined(__ATOMIC_RELAXED) && defined(__ATOMIC_SEQ_CST)
/* Implementation using __atomic macros. */

View File

@ -430,6 +430,8 @@ int clusterLockConfig(char *filename) {
* (redis-aof-rewrite) is still alive, the fd(lock) will still be held by the
* child process, and the main process will fail to get lock, means fail to start. */
server.cluster_config_file_lock_fd = fd;
#else
UNUSED(filename);
#endif /* __sun */
return C_OK;

View File

@ -1002,7 +1002,7 @@ void configGetCommand(client *c) {
}
if (stringmatch(pattern,"unixsocketperm",1)) {
char buf[32];
snprintf(buf,sizeof(buf),"%o",server.unixsocketperm);
snprintf(buf,sizeof(buf),"%lo",(unsigned long) server.unixsocketperm);
addReplyBulkCString(c,"unixsocketperm");
addReplyBulkCString(c,buf);
matches++;

View File

@ -1757,7 +1757,7 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
"Accessing address: %p", (void*)info->si_addr);
}
if (info->si_pid != -1) {
serverLog(LL_WARNING, "Killed by PID: %d, UID: %d", info->si_pid, info->si_uid);
serverLog(LL_WARNING, "Killed by PID: %ld, UID: %d", (long) info->si_pid, info->si_uid);
}
#ifdef HAVE_BACKTRACE

View File

@ -7084,7 +7084,7 @@ int RM_Fork(RedisModuleForkDoneHandler cb, void *user_data) {
moduleForkInfo.done_handler = cb;
moduleForkInfo.done_handler_user_data = user_data;
updateDictResizePolicy();
serverLog(LL_VERBOSE, "Module fork started pid: %d ", childpid);
serverLog(LL_VERBOSE, "Module fork started pid: %ld ", (long) childpid);
}
return childpid;
}
@ -7134,8 +7134,8 @@ int RM_KillForkChild(int child_pid) {
void ModuleForkDoneHandler(int exitcode, int bysignal) {
serverLog(LL_NOTICE,
"Module fork exited pid: %d, retcode: %d, bysignal: %d",
server.module_child_pid, exitcode, bysignal);
"Module fork exited pid: %ld, retcode: %d, bysignal: %d",
(long) server.module_child_pid, exitcode, bysignal);
if (moduleForkInfo.done_handler) {
moduleForkInfo.done_handler(exitcode, bysignal,
moduleForkInfo.done_handler_user_data);

View File

@ -1432,7 +1432,7 @@ int rdbSaveBackground(char *filename, rdbSaveInfo *rsi) {
strerror(errno));
return C_ERR;
}
serverLog(LL_NOTICE,"Background saving started by pid %d",childpid);
serverLog(LL_NOTICE,"Background saving started by pid %ld",(long) childpid);
server.rdb_save_time_start = time(NULL);
server.rdb_child_pid = childpid;
server.rdb_child_type = RDB_CHILD_TYPE_DISK;
@ -2826,8 +2826,8 @@ int rdbSaveToSlavesSockets(rdbSaveInfo *rsi) {
server.rdb_pipe_numconns_writing = 0;
closeChildInfoPipe();
} else {
serverLog(LL_NOTICE,"Background RDB transfer started by pid %d",
childpid);
serverLog(LL_NOTICE,"Background RDB transfer started by pid %ld",
(long) childpid);
server.rdb_save_time_start = time(NULL);
server.rdb_child_pid = childpid;
server.rdb_child_type = RDB_CHILD_TYPE_SOCKET;

View File

@ -749,9 +749,8 @@ sds getAbsolutePath(char *filename) {
* Gets the proper timezone in a more portable fashion
* i.e timezone variables are linux specific.
*/
unsigned long getTimeZone(void) {
#ifdef __linux__
#if defined(__linux__) || defined(__sun)
return timezone;
#else
struct timeval tv;

View File

@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
/* This function provide us access to the original libc free(). This is useful
* for instance to free results obtained by backtrace_symbols(). We need
@ -333,7 +334,6 @@ void zmalloc_set_oom_handler(void (*oom_handler)(size_t)) {
* version of the function. */
#if defined(HAVE_PROC_STAT)
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -346,7 +346,7 @@ size_t zmalloc_get_rss(void) {
int fd, count;
char *p, *x;
snprintf(filename,256,"/proc/%d/stat",getpid());
snprintf(filename,256,"/proc/%ld/stat",(long) getpid());
if ((fd = open(filename,O_RDONLY)) == -1) return 0;
if (read(fd,buf,4096) <= 0) {
close(fd);
@ -370,9 +370,6 @@ size_t zmalloc_get_rss(void) {
return rss;
}
#elif defined(HAVE_TASKINFO)
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <mach/task.h>
@ -393,7 +390,6 @@ size_t zmalloc_get_rss(void) {
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <unistd.h>
size_t zmalloc_get_rss(void) {
struct kinfo_proc info;
@ -416,7 +412,6 @@ size_t zmalloc_get_rss(void) {
#elif defined(__NetBSD__)
#include <sys/types.h>
#include <sys/sysctl.h>
#include <unistd.h>
size_t zmalloc_get_rss(void) {
struct kinfo_proc2 info;
@ -443,7 +438,7 @@ size_t zmalloc_get_rss(void) {
char filename[256];
int fd;
snprintf(filename,256,"/proc/%d/psinfo",getpid());
snprintf(filename,256,"/proc/%ld/psinfo",(long) getpid());
if ((fd = open(filename,O_RDONLY)) == -1) return 0;
if (ioctl(fd, PIOCPSINFO, &info) == -1) {

View File

@ -2,13 +2,12 @@
# find the OS
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
# Compile flags for linux / osx
ifeq ($(uname_S),Linux)
SHOBJ_CFLAGS ?= -W -Wall -fno-common -g -ggdb -std=c99 -O2
SHOBJ_LDFLAGS ?= -shared
else
ifeq ($(uname_S),Darwin)
SHOBJ_CFLAGS ?= -W -Wall -dynamic -fno-common -g -ggdb -std=c99 -O2
SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
else # Linux, others
SHOBJ_CFLAGS ?= -W -Wall -fno-common -g -ggdb -std=c99 -O2
SHOBJ_LDFLAGS ?= -shared
endif
TEST_MODULES = \