aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-07-08 16:41:54 +0200
committerMicael Karlberg <[email protected]>2019-07-08 16:41:54 +0200
commitea41f795b8e3b18051fdb502fc597caf559ebc4c (patch)
tree7baac6f3e089bf41a8e6773654ef031a5c1c7b7f /erts/preloaded/src
parenta8981b70f9e12e0beae931e1de6bd182c83c9df0 (diff)
parent1e2343e748ba212536a568a5d40357d75ccb6b7a (diff)
downloadotp-ea41f795b8e3b18051fdb502fc597caf559ebc4c.tar.gz
otp-ea41f795b8e3b18051fdb502fc597caf559ebc4c.tar.bz2
otp-ea41f795b8e3b18051fdb502fc597caf559ebc4c.zip
Merge branch 'maint'
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r--erts/preloaded/src/socket.erl38
1 files changed, 36 insertions, 2 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl
index e9a76dc1e9..be94e3a867 100644
--- a/erts/preloaded/src/socket.erl
+++ b/erts/preloaded/src/socket.erl
@@ -31,7 +31,7 @@
debug/1,
%% command/1,
- info/0,
+ info/0, info/1,
supports/0, supports/1, supports/2, supports/3
]).
@@ -67,6 +67,10 @@
select_ref/0,
select_info/0,
+ socket_counters/0,
+ socket_counter/0,
+ socket_info/0,
+
%% command/0,
domain/0,
@@ -153,6 +157,15 @@
}.
%% -type command() :: debug_command().
+-type socket_counters() :: [{socket_counter(), non_neg_integer()}].
+-type socket_counter() :: read_byte | read_fails | read_pkg | read_tries |
+ read_waits | write_byte | write_fails | write_pkg |
+ write_tries | write_waits.
+-type socket_info() :: #{counters := socket_counters(),
+ num_readers := non_neg_integer(),
+ num_writers := non_neg_integer(),
+ num_acceptors := non_neg_integer()}.
+
-type uint8() :: 0..16#FF.
-type uint16() :: 0..16#FFFF.
-type uint20() :: 0..16#FFFFF.
@@ -879,7 +892,7 @@ on_load(Extra) ->
--spec info() -> list().
+-spec info() -> map().
info() ->
nif_info().
@@ -904,6 +917,24 @@ command(#{command := debug,
%% ===========================================================================
%%
+%% info - Get miscellaneous information about a socket.
+%%
+%% Generates a list of various info about the socket, such as counter values.
+%%
+%% Do *not* call this function often.
+%%
+%% ===========================================================================
+
+-spec info(Socket) -> socket_info() when
+ Socket :: socket().
+
+info(#socket{ref = SockRef}) ->
+ nif_info(SockRef).
+
+
+
+%% ===========================================================================
+%%
%% supports - get information about what the platform "supports".
%%
%% Generates a list of various info about what the plaform can support.
@@ -3879,6 +3910,9 @@ error(Reason) ->
nif_info() ->
erlang:nif_error(undef).
+nif_info(_SRef) ->
+ erlang:nif_error(undef).
+
nif_command(_Command) ->
erlang:nif_error(undef).