summaryrefslogtreecommitdiffstats
path: root/src/cfg_utils.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-22 17:39:03 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-22 17:39:03 +0400
commite9d2ad6a1b942cb5bbba9a268cc7e0108a0145ea (patch)
treea22232f181b0b6e0af3056869c666578fa30c0c0 /src/cfg_utils.c
parentd81433607b87acf08bab4ccb5a01f1c992dfb8bb (diff)
downloadrspamd-e9d2ad6a1b942cb5bbba9a268cc7e0108a0145ea.tar.gz
rspamd-e9d2ad6a1b942cb5bbba9a268cc7e0108a0145ea.zip
* Rewrite buffered input for line policy (again)
* Fix issue with links that are ip addresses in numeric form in surbl * On Darwin use BSD style sendfile definition * Reorganize platform specific knobs in CMakeLists * Use gettimeofday on systems that have not clock_getres * Use ftime for dns trans id generation on systems without clock_getres
Diffstat (limited to 'src/cfg_utils.c')
-rw-r--r--src/cfg_utils.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index 84115f4f7..26730305e 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -533,7 +533,9 @@ get_config_checksum (struct config_file *cfg)
void
post_load_config (struct config_file *cfg)
{
+#ifdef HAVE_CLOCK_GETTIME
struct timespec ts;
+#endif
struct metric *def_metric;
g_hash_table_foreach (cfg->variables, substitute_all_variables, cfg);
@@ -541,13 +543,15 @@ post_load_config (struct config_file *cfg)
parse_filters_str (cfg, cfg->filters_str);
fill_cfg_params (cfg);
+#ifdef HAVE_CLOCK_GETTIME
#ifdef HAVE_CLOCK_PROCESS_CPUTIME_ID
clock_getres (CLOCK_PROCESS_CPUTIME_ID, &ts);
-#elif defined(HAVE_CLOCK_VIRTUAL)
+# elif defined(HAVE_CLOCK_VIRTUAL)
clock_getres (CLOCK_VIRTUAL, &ts);
-#else
+# else
clock_getres (CLOCK_REALTIME, &ts);
-#endif
+# endif
+
cfg->clock_res = (int)log10 (1000000 / ts.tv_nsec);
if (cfg->clock_res < 0) {
cfg->clock_res = 0;
@@ -555,6 +559,10 @@ post_load_config (struct config_file *cfg)
if (cfg->clock_res > 3) {
cfg->clock_res = 3;
}
+#else
+ /* For gettimeofday */
+ cfg->clock_res = 1;
+#endif
if ((def_metric = g_hash_table_lookup (cfg->metrics, DEFAULT_METRIC)) == NULL) {
def_metric = check_metric_conf (cfg, NULL);