From 7a932b74cc22097655d6792f64cab66bb0fe1694 Mon Sep 17 00:00:00 2001 From: antirez Date: Sat, 28 Nov 2009 17:06:28 +0100 Subject: [PATCH] ifdefs added to use kevent on Free Open and Net BSD as well. INFO and ae.c modified in order to report the multiplexing API in use --- ae.c | 7 +++++-- ae.h | 1 + ae_epoll.c | 4 ++++ ae_kqueue.c | 4 ++++ ae_select.c | 4 ++++ config.h | 2 +- redis.c | 2 ++ test-redis.tcl | 5 ++++- 8 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ae.c b/ae.c index 048fa51c4..81fd9add8 100644 --- a/ae.c +++ b/ae.c @@ -373,9 +373,12 @@ int aeWait(int fd, int mask, long long milliseconds) { } } -void aeMain(aeEventLoop *eventLoop) -{ +void aeMain(aeEventLoop *eventLoop) { eventLoop->stop = 0; while (!eventLoop->stop) aeProcessEvents(eventLoop, AE_ALL_EVENTS); } + +char *aeGetApiName(void) { + return aeApiName(); +} diff --git a/ae.h b/ae.h index 499063ca9..0a056ce91 100644 --- a/ae.h +++ b/ae.h @@ -111,5 +111,6 @@ int aeDeleteTimeEvent(aeEventLoop *eventLoop, long long id); int aeProcessEvents(aeEventLoop *eventLoop, int flags); int aeWait(int fd, int mask, long long milliseconds); void aeMain(aeEventLoop *eventLoop); +char *aeGetApiName(void); #endif diff --git a/ae_epoll.c b/ae_epoll.c index 8fb5d4c38..f6371b0be 100644 --- a/ae_epoll.c +++ b/ae_epoll.c @@ -85,3 +85,7 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) { } return numevents; } + +static char *aeApiName(void) { + return "epoll"; +} diff --git a/ae_kqueue.c b/ae_kqueue.c index 6408e3222..04c3536ba 100644 --- a/ae_kqueue.c +++ b/ae_kqueue.c @@ -87,3 +87,7 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) { } return numevents; } + +static char *aeApiName(void) { + return "kqueue"; +} diff --git a/ae_select.c b/ae_select.c index 2f7185b0a..11fd719aa 100644 --- a/ae_select.c +++ b/ae_select.c @@ -72,3 +72,7 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) { } return numevents; } + +static char *aeApiName(void) { + return "select"; +} diff --git a/config.h b/config.h index 86e943dd9..7cf0f0a30 100644 --- a/config.h +++ b/config.h @@ -31,7 +31,7 @@ #define HAVE_EPOLL 1 #endif -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__) #define HAVE_KQUEUE 1 #endif diff --git a/redis.c b/redis.c index 1236d9b5b..56ee14963 100644 --- a/redis.c +++ b/redis.c @@ -5018,6 +5018,7 @@ static void infoCommand(redisClient *c) { info = sdscatprintf(sdsempty(), "redis_version:%s\r\n" "arch_bits:%s\r\n" + "multiplexing_api:%s\r\n" "uptime_in_seconds:%d\r\n" "uptime_in_days:%d\r\n" "connected_clients:%d\r\n" @@ -5031,6 +5032,7 @@ static void infoCommand(redisClient *c) { "role:%s\r\n" ,REDIS_VERSION, (sizeof(long) == 8) ? "64" : "32", + aeGetApiName(), uptime, uptime/(3600*24), listLength(server.clients)-listLength(server.slaves), diff --git a/test-redis.tcl b/test-redis.tcl index 00850c815..354016e03 100644 --- a/test-redis.tcl +++ b/test-redis.tcl @@ -1,4 +1,7 @@ -# TODO # test pipelining +# test-redis.tcl +# Redis test suite. Copyright (C) 2009 Salvatore Sanfilippo antirez@gmail.com +# This softare is released under the BSD License. See the COPYING file for +# more information. set tcl_precision 17 source redis.tcl -- GitLab