diff options
author | Micael Karlberg <[email protected]> | 2018-06-13 10:54:01 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 13:01:37 +0200 |
commit | cb858ed68f2cc21014f37c8f6c1cb0dfc20f6184 (patch) | |
tree | 4873d733e45c9e445c4263eecbc13277669491ff /erts/preloaded/src | |
parent | 348677edc60a33bf31210a0ddfeb327e1be6f9c2 (diff) | |
download | otp-cb858ed68f2cc21014f37c8f6c1cb0dfc20f6184.tar.gz otp-cb858ed68f2cc21014f37c8f6c1cb0dfc20f6184.tar.bz2 otp-cb858ed68f2cc21014f37c8f6c1cb0dfc20f6184.zip |
[socket-nif] The info function now returns a non-empty map
The map returned by the info function is now populated
with the "global stuff". That is, debug, iow and the
(global) counters (which are still not actually incremented).
Also added debug functions and macros (not yet used).
OTP-14831
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/socket.erl | 75 |
1 files changed, 12 insertions, 63 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 90fe5b9f36..bab4fce3f3 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -49,12 +49,7 @@ shutdown/2, setopt/4, - getopt/3, - - %% Some IPv6 utility functions - link_if2idx/1, - link_idx2if/1, - link_ifs/0 + getopt/3 ]). -export_type([ @@ -91,12 +86,11 @@ ip_tos_flag/0 ]). - %% We support only a subset of all domains. -type domain() :: local | inet | inet6. %% We support only a subset of all types. --type type() :: stream | dgram | raw | seqpacket. +-type type() :: stream | dgram | raw | rdm | seqpacket. %% We support only a subset of all protocols: -type protocol() :: ip | tcp | udp | sctp. @@ -539,6 +533,15 @@ info() -> %% %% nif_register(SockRef, self()). %% +%% <ALSO> +%% +%% Maybe register the process under a name? +%% Something like: +%% +%% list_to_atom(lists:flatten(io_lib:format("socket-~p", [SockRef]))). +%% +%% </ALSO> +%% %% The nif sets up a monitor to this process, and if it dies the socket %% is closed. It is also used if someone wants to monitor the socket. %% @@ -548,6 +551,7 @@ info() -> %% socket:demonitor(Socket) %% %% These are basically used to monitor the controller process. +%% Should the socket record therefor contain the pid of the controller process? %% %% </KOLLA> %% @@ -1509,53 +1513,6 @@ getopt(#socket{info = Info, ref = SockRef}, Level, Key) -> -%% =========================================================================== -%% -%% link_if2idx - Mappings between network interface names and indexes: if -> idx -%% -%% - --spec link_if2idx(If) -> {ok, Idx} | {error, Reason} when - If :: string(), - Idx :: non_neg_integer(), - Reason :: term(). - -link_if2idx(If) when is_list(If) -> - nif_link_if2idx(If). - - -%% =========================================================================== -%% -%% link_idx2if - Mappings between network interface names and indexes: idx -> if -%% -%% - --spec link_idx2if(Idx) -> {ok, If} | {error, Reason} when - Idx :: non_neg_integer(), - If :: string(), - Reason :: term(). - -link_idx2if(Idx) when is_integer(Idx) -> - nif_link_idx2if(Idx). - - - -%% =========================================================================== -%% -%% link_ifs - get network interface names and indexes -%% -%% - --spec link_ifs() -> Names | {error, Reason} when - Names :: [{Idx, If}], - Idx :: non_neg_integer(), - If :: string(), - Reason :: term(). - -link_ifs() -> - nif_link_ifs(). - - %% =========================================================================== %% @@ -2233,11 +2190,3 @@ nif_setopt(_Ref, _IsEnc, _Lev, _Key, _Val) -> nif_getopt(_Ref, _IsEnc, _Lev, _Key) -> erlang:error(badarg). -nif_link_if2idx(_Name) -> - erlang:error(badarg). - -nif_link_idx2if(_Id) -> - erlang:error(badarg). - -nif_link_ifs() -> - erlang:error(badarg). |