aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-11 17:39:04 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-11 17:39:04 +0300
commit54480f21f115b40e76806210a61bdde00d3842f7 (patch)
treef8e1aad8341c5190d4c73f66db117aa754147cee /src
parentc07cd514e4ea635a59937cf703107ab075e92400 (diff)
downloadrspamd-54480f21f115b40e76806210a61bdde00d3842f7.tar.gz
rspamd-54480f21f115b40e76806210a61bdde00d3842f7.zip
* By default number of workers is number of active processors in system
* Fix macro detection in configure system
Diffstat (limited to 'src')
-rw-r--r--src/cfg_utils.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index 7e1e74b28..4616498cc 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -6,14 +6,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <syslog.h>
#include <netdb.h>
#include <math.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
#include "config.h"
#include "cfg_file.h"
@@ -174,7 +173,11 @@ init_defaults (struct config_file *cfg)
cfg->memcached_maxerrors = DEFAULT_UPSTREAM_MAXERRORS;
cfg->memcached_protocol = TCP_TEXT;
+#ifdef HAVE_SC_NPROCESSORS_ONLN
+ cfg->workers_number = sysconf (_SC_NPROCESSORS_ONLN);
+#else
cfg->workers_number = DEFAULT_WORKERS_NUM;
+#endif
cfg->max_statfile_size = DEFAULT_STATFILE_SIZE;
cfg->modules_opts = g_hash_table_new (g_str_hash, g_str_equal);
cfg->variables = g_hash_table_new (g_str_hash, g_str_equal);