aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-07-08 16:33:53 +0200
committerMicael Karlberg <[email protected]>2019-07-08 16:33:53 +0200
commitf8bd1d27e86b338693b72fd1bd6938876660dfcf (patch)
tree838835a7167fd7a593b6ed2a251dbbd636a497ac /erts/preloaded/src
parent136200e49b7730807d7071af414b28c8aacff759 (diff)
parent13b2197d49d189c32f3a268ed671166ad79767aa (diff)
downloadotp-f8bd1d27e86b338693b72fd1bd6938876660dfcf.tar.gz
otp-f8bd1d27e86b338693b72fd1bd6938876660dfcf.tar.bz2
otp-f8bd1d27e86b338693b72fd1bd6938876660dfcf.zip
Merge branch 'bmk/erts/esock/20190624/socket_command/OTP-15817' into maint
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r--erts/preloaded/src/socket.erl41
1 files changed, 39 insertions, 2 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl
index ae1ffdb4ac..e9a76dc1e9 100644
--- a/erts/preloaded/src/socket.erl
+++ b/erts/preloaded/src/socket.erl
@@ -26,9 +26,13 @@
%% Administrative and "global" utility functions
-export([
on_load/0, on_load/1,
+
+ ensure_sockaddr/1,
+
+ debug/1,
+ %% command/1,
info/0,
- supports/0, supports/1, supports/2, supports/3,
- ensure_sockaddr/1
+ supports/0, supports/1, supports/2, supports/3
]).
-export([
@@ -63,6 +67,8 @@
select_ref/0,
select_info/0,
+ %% command/0,
+
domain/0,
type/0,
protocol/0,
@@ -135,6 +141,18 @@
]).
+%% The command type has the general form:
+%% #{
+%% command := atom(),
+%% data := term()
+%% }
+%% But only certain values are actually valid, so the type gets the form:
+-type debug_command() :: #{
+ command := debug,
+ data := boolean()
+ }.
+%% -type command() :: debug_command().
+
-type uint8() :: 0..16#FF.
-type uint16() :: 0..16#FFFF.
-type uint20() :: 0..16#FFFFF.
@@ -867,6 +885,22 @@ info() ->
nif_info().
+-spec debug(D) -> ok when
+ D :: boolean().
+
+debug(D) when is_boolean(D) ->
+ command(#{command => debug,
+ data => D}).
+
+
+-spec command(Command) -> ok when
+ Command :: debug_command().
+
+command(#{command := debug,
+ data := Dbg} = Command) when is_boolean(Dbg) ->
+ nif_command(Command).
+
+
%% ===========================================================================
%%
@@ -3845,6 +3879,9 @@ error(Reason) ->
nif_info() ->
erlang:nif_error(undef).
+nif_command(_Command) ->
+ erlang:nif_error(undef).
+
nif_supports(_Key) ->
erlang:nif_error(undef).