summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-09-10 19:50:53 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-09-10 19:50:53 +0000
commit460281eb8a044e1e3d0ab2455c5e12d6dcde27ee (patch)
tree246406303d5012d0eafbf493c52d3bdd43054398 /src/core
parent9dd057825bbfe14a17133e0aa3b01f2089a71486 (diff)
downloadirssi-460281eb8a044e1e3d0ab2455c5e12d6dcde27ee.zip
/SET override_coredump_limit - sets core file size to unlimited if set ON
(default). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1783 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/core/core.c b/src/core/core.c
index e3d3bebc..62864388 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -45,6 +45,11 @@
#include "nicklist.h"
#include "nickmatch-cache.h"
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+ struct rlimit orig_core_rlimit;
+#endif
+
void chat_commands_init(void);
void chat_commands_deinit(void);
@@ -67,7 +72,7 @@ const char *get_irssi_config(void)
return irssi_config_file;
}
-static void read_signals(void)
+static void read_settings(void)
{
#ifndef WIN32
int signals[] = {
@@ -93,6 +98,19 @@ static void read_signals(void)
SIG_IGN : SIG_DFL;
sigaction(signals[n], &act, NULL);
}
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (!settings_get_bool("override_coredump_limit"))
+ setrlimit(RLIMIT_CORE, &orig_core_rlimit);
+ else {
+ struct rlimit rlimit;
+
+ rlimit.rlim_cur = RLIM_INFINITY;
+ rlimit.rlim_max = RLIM_INFINITY;
+ if (setrlimit(RLIMIT_CORE, &rlimit) == -1)
+ settings_set_bool("override_coredump_limit", FALSE);
+ }
+#endif
#endif
}
@@ -208,8 +226,13 @@ void core_init(int argc, char *argv[])
chat_commands_init();
settings_add_str("misc", "ignore_signals", "");
- signal_add("setup changed", (SIGNAL_FUNC) read_signals);
- read_signals();
+ settings_add_bool("misc", "override_coredump_limit", TRUE);
+
+#ifdef HAVE_SYS_RESOURCE_H
+ getrlimit(RLIMIT_CORE, &orig_core_rlimit);
+#endif
+ read_settings();
+ signal_add("setup changed", (SIGNAL_FUNC) read_settings);
settings_check();
@@ -218,7 +241,7 @@ void core_init(int argc, char *argv[])
void core_deinit(void)
{
- signal_remove("setup changed", (SIGNAL_FUNC) read_signals);
+ signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
chat_commands_deinit();