diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-01-13 12:13:43 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-01-23 15:06:57 +0100 |
commit | 86d605807356f79f3484c36cba632ff88d4e2417 (patch) | |
tree | c87c7ebf44ce76ae90dcc344424e464987917358 /erts/emulator/beam | |
parent | d373dc49ae4c8a2d27dde23564bcaf2642cc46e5 (diff) | |
download | otp-86d605807356f79f3484c36cba632ff88d4e2417.tar.gz otp-86d605807356f79f3484c36cba632ff88d4e2417.tar.bz2 otp-86d605807356f79f3484c36cba632ff88d4e2417.zip |
erts: Use emergency close to close epmd
Closes all open socket before writing crashdump to file.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/global.h | 1 | ||||
-rw-r--r-- | erts/emulator/beam/io.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h index d25daaf7b8..32a2dc43e8 100644 --- a/erts/emulator/beam/global.h +++ b/erts/emulator/beam/global.h @@ -853,6 +853,7 @@ Uint erts_port_ioq_size(Port *pp); void erts_stale_drv_select(Eterm, ErlDrvPort, ErlDrvEvent, int, int); Port *erts_get_heart_port(void); +void erts_emergency_close_ports(void); #if defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_COUNT) void erts_lcnt_enable_io_lock_count(int enable); diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index 4ae8fafb2c..3316654790 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -7569,3 +7569,23 @@ Port *erts_get_heart_port(void) return NULL; } + +void erts_emergency_close_ports(void) +{ + int ix, max = erts_ptab_max(&erts_port); + + for (ix = 0; ix < max; ix++) { + Port *port = erts_pix2port(ix); + + if (!port) + continue; + /* only examine undead or alive ports */ + if (erts_atomic32_read_nob(&port->state) & ERTS_PORT_SFLGS_DEAD) + continue; + + /* emergency close socket */ + if (port->drv_ptr->emergency_close) { + port->drv_ptr->emergency_close((ErlDrvData) port->drv_data); + } + } +} |