From 3c83516283deb5286ecaf72411fc150c8e2eee20 Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Wed, 30 Mar 2011 15:56:16 +0200 Subject: [PATCH] Fix usage counters. Add conditonal on print_meminfo. Does not work on OS X --- src/connection.c | 5 +++-- src/eventl.c | 4 ++-- src/http_command.c | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/connection.c b/src/connection.c index c4dfe72..6e2c745 100644 --- a/src/connection.c +++ b/src/connection.c @@ -52,14 +52,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA static YAZ_MUTEX g_mutex = 0; static int no_connections = 0; static int total_no_connections = 0; -static void connection_use(int delta) + +static int connection_use(int delta) { int result; if (!g_mutex) yaz_mutex_create(&g_mutex); yaz_mutex_enter(g_mutex); no_connections += delta; - result = no_connection; + result = no_connections; if (delta > 0) total_no_connections += delta; yaz_mutex_leave(g_mutex); diff --git a/src/eventl.c b/src/eventl.c index 8fd9a67..840b735 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -72,7 +72,7 @@ static int iochan_use(int delta) no_iochans += delta; if (delta > 0) no_iochans_total += delta; - iochans = no_clients; + iochans = no_iochans; yaz_mutex_leave(g_mutex); yaz_log(YLOG_DEBUG, "%s iochans=%d", delta == 0 ? "" : (delta > 0 ? "INC" : "DEC"), iochans); return iochans; @@ -336,7 +336,7 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) { for (nextp = iochans; *nextp;) { IOCHAN p = *nextp; if (p->destroyed && p->thread_users == 0) { - *nextp = iochan_destroy_real(iochan); + *nextp = iochan_destroy_real(nextp); } else nextp = &p->next; } diff --git a/src/http_command.c b/src/http_command.c index 9d464d6..5b84951 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -41,10 +41,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "settings.h" #include "client.h" +#ifdef __LINUX__ #include - void print_meminfo(WRBUF wrbuf) { -#ifdef __GNUC__ struct mallinfo minfo; minfo = mallinfo(); wrbuf_printf(wrbuf, " \n" @@ -60,8 +59,10 @@ void print_meminfo(WRBUF wrbuf) { " \n", minfo.arena, minfo.uordblks, minfo.fordblks,minfo.ordblks, minfo.keepcost, minfo.hblks, minfo.hblkhd, minfo.arena + minfo.hblkhd, minfo.uordblks + minfo.hblkhd); -#endif } +#else +#define print_meminfo(x) +#endif // Update this when the protocol changes -- 1.7.10.4