diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-01-13 15:21:20 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-01-23 15:08:23 +0100 |
commit | 5f036bc287f325b3367f8437997534c44812078f (patch) | |
tree | 34f0e86bab29466821174534ba9ac30f5f5df90f /erts/emulator | |
parent | 86d605807356f79f3484c36cba632ff88d4e2417 (diff) | |
download | otp-5f036bc287f325b3367f8437997534c44812078f.tar.gz otp-5f036bc287f325b3367f8437997534c44812078f.tar.bz2 otp-5f036bc287f325b3367f8437997534c44812078f.zip |
erts: Reserve a file descriptor for the crashdump file
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/sys/unix/sys.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c index 24f229ae68..eff64b2c11 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -244,6 +244,8 @@ static void note_child_death(int, int); static void* child_waiter(void *); #endif +static int crashdump_companion_cube_fd = -1; + /********************* General functions ****************************/ /* This is used by both the drivers and general I/O, must be set early */ @@ -573,6 +575,14 @@ erts_sys_pre_init(void) close(fd); } + /* We need a file descriptor to close in the crashdump creation. + * We close this one to be sure we can get a fd for our real file ... + * so, we create one here ... a stone to carry all the way home. + */ + + crashdump_companion_cube_fd = open("/dev/null", O_RDONLY); + + /* don't lose it, there will be cake */ } void @@ -760,7 +770,8 @@ prepare_crash_dump(int secs) heart_port->common.id, list, NULL); } - /* FIXME: Reserve one file descriptor */ + /* Make sure we have a fd for our crashdump file. */ + close(crashdump_companion_cube_fd); envsz = sizeof(env); i = erts_sys_getenv__("ERL_CRASH_DUMP_NICE", env, &envsz); |