diff options
author | Sverker Eriksson <[email protected]> | 2018-02-19 11:59:12 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2018-02-20 17:37:21 +0100 |
commit | cff79c76c3fb574addb5c9364f7c4c7d48a75907 (patch) | |
tree | dd27a97ebe02c91dc75e1c74b0d2849b5d1dc9e5 /erts/emulator/beam/erl_bif_port.c | |
parent | 43edeef1d224ace49dac13d6a5778cd0b50f1d25 (diff) | |
download | otp-cff79c76c3fb574addb5c9364f7c4c7d48a75907.tar.gz otp-cff79c76c3fb574addb5c9364f7c4c7d48a75907.tar.bz2 otp-cff79c76c3fb574addb5c9364f7c4c7d48a75907.zip |
erts,observer: Add more port info to crash dump
Diffstat (limited to 'erts/emulator/beam/erl_bif_port.c')
-rw-r--r-- | erts/emulator/beam/erl_bif_port.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_bif_port.c b/erts/emulator/beam/erl_bif_port.c index ff03151619..d05507118e 100644 --- a/erts/emulator/beam/erl_bif_port.c +++ b/erts/emulator/beam/erl_bif_port.c @@ -647,6 +647,27 @@ BIF_RETTYPE port_get_data_1(BIF_ALIST_1) BIF_RET(res); } +Eterm erts_port_data_read(Port* prt) +{ + Eterm res; + erts_aint_t data; + + data = erts_smp_atomic_read_ddrb(&prt->data); + if (data == (erts_aint_t)NULL) + return am_undefined; /* Port terminated by racing thread */ + + if ((data & 0x3) != 0) { + res = (Eterm) (UWord) data; + ASSERT(is_immed(res)); + } + else { + ErtsPortDataHeap *pdhp = (ErtsPortDataHeap *) data; + res = pdhp->data; + } + return res; +} + + /* * Open a port. Most of the work is not done here but rather in * the file io.c. |