From ee35bff867d4670742c4e410eb79c3d421d32291 Mon Sep 17 00:00:00 2001 From: Richard Kunze Date: Wed, 12 Sep 2012 20:54:37 +0200 Subject: [PATCH] Fix compile error on systems without loadavg() (e.g. uClibc) --- configure | 3 +++ src/webui/simpleui.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 7c807f5e..b2ca953d 100755 --- a/configure +++ b/configure @@ -44,6 +44,9 @@ check_cc_header execinfo check_cc_option mmx check_cc_option sse2 +check_cc_snippet getloadavg '#include +void test() { getloadavg(NULL,0); }' + # # Python # diff --git a/src/webui/simpleui.c b/src/webui/simpleui.c index d3c5e895..f0566b11 100644 --- a/src/webui/simpleui.c +++ b/src/webui/simpleui.c @@ -30,6 +30,7 @@ #include "access.h" #include "epg.h" #include "dvr/dvr.h" +#include "config.h" #define ACCESS_SIMPLE \ (ACCESS_WEB_INTERFACE | ACCESS_RECORDER) @@ -365,18 +366,23 @@ page_status(http_connection_t *hc, const char *remain, void *opaque) { htsbuf_queue_t *hq = &hc->hc_reply; - int c, i, cc, timeleft, timelefttemp, loads; + int c, i, cc, timeleft, timelefttemp; struct tm a, b; dvr_entry_t *de; dvr_query_result_t dqr; const char *rstatus; time_t now; - double avg[3]; char buf[500]; +#ifdef ENABLE_GETLOADAVG + int loads; + double avg[3]; +#endif + htsbuf_qprintf(hq, "\n" "\n"); +#ifdef ENABLE_GETLOADAVG loads = getloadavg (avg, 3); if (loads == -1) { tvhlog(LOG_DEBUG, "webui", "Error getting load average from getloadavg()"); @@ -386,7 +392,7 @@ page_status(http_connection_t *hc, } else { htsbuf_qprintf(hq, "%f,%f,%f\n",avg[0],avg[1],avg[2]); }; - +#endif htsbuf_qprintf(hq,"\n"); pthread_mutex_lock(&global_lock);