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 */
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
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);
}
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;
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;
}
* @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