struct rspamd_worker_bind_conf *bind_conf; /**< bind configuration */
gint16 count; /**< number of workers */
GList *listen_socks; /**< listening sockets descriptors */
- guint32 rlimit_nofile; /**< max files limit */
- guint32 rlimit_maxcore; /**< maximum core file size */
+ guint64 rlimit_nofile; /**< max files limit */
+ guint64 rlimit_maxcore; /**< maximum core file size */
GHashTable *params; /**< params for worker */
GQueue *active_workers; /**< linked list of spawned workers */
gboolean has_socket; /**< whether we should make listening socket in main process */
"max_files",
rspamd_rcl_parse_struct_integer,
G_STRUCT_OFFSET (struct rspamd_worker_conf, rlimit_nofile),
- RSPAMD_CL_FLAG_INT_32,
+ RSPAMD_CL_FLAG_INT_64,
"Maximum number of opened files per worker");
rspamd_rcl_add_default_handler (sub,
"max_core",
rspamd_rcl_parse_struct_integer,
G_STRUCT_OFFSET (struct rspamd_worker_conf, rlimit_maxcore),
- RSPAMD_CL_FLAG_INT_32,
+ RSPAMD_CL_FLAG_INT_64,
"Max size of core file in bytes");
rspamd_rcl_add_default_handler (sub,
"enabled",
rlmt.rlim_max = (rlim_t) cf->rlimit_maxcore;
if (setrlimit (RLIMIT_CORE, &rlmt) == -1) {
- msg_warn_main ("cannot set max core rlimit: %d, %s",
+ msg_warn_main ("cannot set max core rlimit: %HL, %s",
cf->rlimit_maxcore,
strerror (errno));
}
+
+ /* Ensure that we did it */
+ memset (&rlmt, 0, sizeof (rlmt));
+
+ if (getrlimit (RLIMIT_CORE, &rlmt) == -1) {
+ msg_warn_main ("cannot get max core rlimit: %HL, %s",
+ cf->rlimit_maxcore,
+ strerror (errno));
+ }
+
+ if (rlmt.rlim_cur != cf->rlimit_maxcore ||
+ rlmt.rlim_max != cf->rlimit_maxcore) {
+ msg_warn_main ("setting of limits was unsuccessful: %HL was wanted, "
+ "but we have %HL cur and %HL max",
+ cf->rlimit_maxcore,
+ (guint64)rlmt.rlim_cur,
+ (guint64)rlmt.rlim_max);
+ }
}
}
}