aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/io.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-01-13 12:13:43 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-01-23 15:06:57 +0100
commit86d605807356f79f3484c36cba632ff88d4e2417 (patch)
treec87c7ebf44ce76ae90dcc344424e464987917358 /erts/emulator/beam/io.c
parentd373dc49ae4c8a2d27dde23564bcaf2642cc46e5 (diff)
downloadotp-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/io.c')
-rw-r--r--erts/emulator/beam/io.c20
1 files changed, 20 insertions, 0 deletions
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);
+ }
+ }
+}