aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_init.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-11-22 14:37:31 +0100
committerSverker Eriksson <[email protected]>2016-11-22 14:37:31 +0100
commit491cd4c0c0a534ab89c3ebb4c413301c91c7167d (patch)
tree8859c2da401857dd280cf79917aea847b630b714 /erts/emulator/beam/erl_init.c
parentdcc7f6b2901a632ff8398c1382c15eaabe562714 (diff)
downloadotp-491cd4c0c0a534ab89c3ebb4c413301c91c7167d.tar.gz
otp-491cd4c0c0a534ab89c3ebb4c413301c91c7167d.tar.bz2
otp-491cd4c0c0a534ab89c3ebb4c413301c91c7167d.zip
erts: Add env variable ERL_CRASH_DUMP_BYTES
to limit crash dump size
Diffstat (limited to 'erts/emulator/beam/erl_init.c')
-rw-r--r--erts/emulator/beam/erl_init.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index 781bf024dd..362239f765 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -2374,6 +2374,8 @@ system_cleanup(int flush_async)
erts_exit_flush_async();
}
+static int erts_exit_code;
+
static __decl_noreturn void __noreturn
erts_exit_vv(int n, int flush_async, char *fmt, va_list args1, va_list args2)
{
@@ -2385,12 +2387,21 @@ erts_exit_vv(int n, int flush_async, char *fmt, va_list args1, va_list args2)
if (fmt != NULL && *fmt != '\0')
erl_error(fmt, args2); /* Print error message. */
- /* Produce an Erlang core dump if error */
+ erts_exit_code = n;
+
+ /* Produce an Erlang crash dump if error */
if (((n == ERTS_ERROR_EXIT && erts_no_crash_dump == 0) || n == ERTS_DUMP_EXIT)
&& erts_initialized) {
erl_crash_dump_v((char*) NULL, 0, fmt, args1);
}
+ erts_exit_epilogue();
+}
+
+__decl_noreturn void __noreturn erts_exit_epilogue(void)
+{
+ int n = erts_exit_code;
+
sys_tty_reset(n);
if (n == ERTS_INTR_EXIT)