diff options
author | Rickard Green <[email protected]> | 2017-06-30 16:32:42 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2017-08-28 14:40:52 +0200 |
commit | 78fad16ef7c5477239bc0b51125fabfe6567039d (patch) | |
tree | 87071be4c822f110bfcac704d7d8484b3325f0ab /erts/preloaded/src/erts_internal.erl | |
parent | 6b267b203c950db2879f254b6a9d3b7591115f9d (diff) | |
download | otp-78fad16ef7c5477239bc0b51125fabfe6567039d.tar.gz otp-78fad16ef7c5477239bc0b51125fabfe6567039d.tar.bz2 otp-78fad16ef7c5477239bc0b51125fabfe6567039d.zip |
Support for distribution controller processes
Diffstat (limited to 'erts/preloaded/src/erts_internal.erl')
-rw-r--r-- | erts/preloaded/src/erts_internal.erl | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/erts/preloaded/src/erts_internal.erl b/erts/preloaded/src/erts_internal.erl index 26fb1458af..bb1824ecd4 100644 --- a/erts/preloaded/src/erts_internal.erl +++ b/erts/preloaded/src/erts_internal.erl @@ -61,6 +61,8 @@ -export([trace/3, trace_pattern/3]). +-export([dist_ctrl_put_data/2]). + %% Auto import name clash -export([check_process_code/1]). @@ -461,3 +463,38 @@ trace(_PidSpec, _How, _FlagList) -> FlagList :: [ ]. trace_pattern(_MFA, _MatchSpec, _FlagList) -> erlang:nif_error(undefined). + +-spec dist_ctrl_put_data(DHandle, Data) -> 'ok' when + DHandle :: erlang:dist_handle(), + Data :: iolist(). + +dist_ctrl_put_data(DHandle, IoList) -> + %% + %% Helper for erlang:dist_ctrl_put_data/2 + %% + %% erlang:dist_ctrl_put_data/2 traps to + %% this function if second argument is + %% a list... + %% + try + Binary = erlang:iolist_to_binary(IoList), + %% Restart erlang:dist_ctrl_put_data/2 + %% with the iolist converted to a binary... + erlang:dist_ctrl_put_data(DHandle, Binary) + catch + Class : Reason -> + %% Throw exception as if thrown from + %% erlang:dist_ctrl_put_data/2 ... + RootST = try erlang:error(Reason) + catch + error:Reason -> + case erlang:get_stacktrace() of + [] -> []; + ST -> tl(ST) + end + end, + StackTrace = [{erlang, dist_ctrl_put_data, + [DHandle, IoList], []} + | RootST], + erlang:raise(Class, Reason, StackTrace) + end. |