@@ -280,6 +280,7 @@ struct config_file { | |||
gsize max_statfile_size; /**< maximum size for statfile */ | |||
guint32 statfile_sync_interval; /**< synchronization interval */ | |||
guint32 statfile_sync_timeout; /**< synchronization timeout */ | |||
gboolean mlock_statfile_pool; /**< use mlock (2) for locking statfiles */ | |||
struct memcached_server memcached_servers[MAX_MEMCACHED_SERVERS]; /**< memcached servers */ | |||
gsize memcached_servers_num; /**< number of memcached servers */ |
@@ -318,6 +318,12 @@ static struct xml_parser_rule grammar[] = { | |||
G_STRUCT_OFFSET (struct config_file, dynamic_conf), | |||
NULL | |||
}, | |||
{ | |||
"use_mlock", | |||
xml_handle_boolean, | |||
G_STRUCT_OFFSET (struct config_file, mlock_statfile_pool), | |||
NULL | |||
}, | |||
NULL_ATTR | |||
}, | |||
NULL_DEF_ATTR |
@@ -977,7 +977,7 @@ main (gint argc, gchar **argv, gchar **env) | |||
setproctitle ("main process"); | |||
/* Init statfile pool */ | |||
rspamd_main->statfile_pool = statfile_pool_new (rspamd_main->server_pool, rspamd_main->cfg->max_statfile_size); | |||
rspamd_main->statfile_pool = statfile_pool_new (rspamd_main->server_pool, rspamd_main->cfg->max_statfile_size, rspamd_main->cfg->mlock_statfile_pool); | |||
event_init (); | |||
g_mime_init (0); |
@@ -205,7 +205,7 @@ statfile_pool_expire (statfile_pool_t * pool) | |||
} | |||
statfile_pool_t * | |||
statfile_pool_new (memory_pool_t *pool, size_t max_size) | |||
statfile_pool_new (memory_pool_t *pool, size_t max_size, gboolean use_mlock) | |||
{ | |||
statfile_pool_t *new; | |||
@@ -214,7 +214,7 @@ statfile_pool_new (memory_pool_t *pool, size_t max_size) | |||
new->max = max_size; | |||
new->files = memory_pool_alloc0 (new->pool, STATFILES_MAX * sizeof (stat_file_t)); | |||
new->lock = memory_pool_get_mutex (new->pool); | |||
new->mlock_ok = TRUE; | |||
new->mlock_ok = use_mlock; | |||
return new; | |||
} |
@@ -106,7 +106,7 @@ struct statfile; | |||
* @param max_size maximum size | |||
* @return statfile pool object | |||
*/ | |||
statfile_pool_t* statfile_pool_new (memory_pool_t *pool, size_t max_size); | |||
statfile_pool_t* statfile_pool_new (memory_pool_t *pool, size_t max_size, gboolean use_mlock); | |||
/** | |||
* Open statfile and attach it to pool |