diff options
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/ebin/erl_init.beam | bin | 2260 -> 2336 bytes | |||
-rw-r--r-- | erts/preloaded/ebin/net.beam | bin | 6096 -> 0 bytes | |||
-rw-r--r-- | erts/preloaded/ebin/prim_file.beam | bin | 27984 -> 28780 bytes | |||
-rw-r--r-- | erts/preloaded/ebin/prim_inet.beam | bin | 81424 -> 81508 bytes | |||
-rw-r--r-- | erts/preloaded/ebin/prim_net.beam | bin | 0 -> 4700 bytes | |||
-rw-r--r-- | erts/preloaded/ebin/socket.beam | bin | 75044 -> 75892 bytes | |||
-rw-r--r-- | erts/preloaded/src/Makefile | 19 | ||||
-rw-r--r-- | erts/preloaded/src/erl_init.erl | 7 | ||||
-rw-r--r-- | erts/preloaded/src/prim_file.erl | 38 | ||||
-rw-r--r-- | erts/preloaded/src/prim_inet.erl | 2 | ||||
-rw-r--r-- | erts/preloaded/src/prim_net.erl (renamed from erts/preloaded/src/net.erl) | 74 | ||||
-rw-r--r-- | erts/preloaded/src/socket.erl | 156 |
12 files changed, 170 insertions, 126 deletions
diff --git a/erts/preloaded/ebin/erl_init.beam b/erts/preloaded/ebin/erl_init.beam Binary files differindex 0c032e8e91..bc7639781c 100644 --- a/erts/preloaded/ebin/erl_init.beam +++ b/erts/preloaded/ebin/erl_init.beam diff --git a/erts/preloaded/ebin/net.beam b/erts/preloaded/ebin/net.beam Binary files differdeleted file mode 100644 index 88d546a3af..0000000000 --- a/erts/preloaded/ebin/net.beam +++ /dev/null diff --git a/erts/preloaded/ebin/prim_file.beam b/erts/preloaded/ebin/prim_file.beam Binary files differindex a2c5f2f336..0152a6091f 100644 --- a/erts/preloaded/ebin/prim_file.beam +++ b/erts/preloaded/ebin/prim_file.beam diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam Binary files differindex f67b660a08..f77e9e863d 100644 --- a/erts/preloaded/ebin/prim_inet.beam +++ b/erts/preloaded/ebin/prim_inet.beam diff --git a/erts/preloaded/ebin/prim_net.beam b/erts/preloaded/ebin/prim_net.beam Binary files differnew file mode 100644 index 0000000000..9d50b3210f --- /dev/null +++ b/erts/preloaded/ebin/prim_net.beam diff --git a/erts/preloaded/ebin/socket.beam b/erts/preloaded/ebin/socket.beam Binary files differindex 134b4eac13..73a0bd4f72 100644 --- a/erts/preloaded/ebin/socket.beam +++ b/erts/preloaded/ebin/socket.beam diff --git a/erts/preloaded/src/Makefile b/erts/preloaded/src/Makefile index 27d450c873..38b85915cc 100644 --- a/erts/preloaded/src/Makefile +++ b/erts/preloaded/src/Makefile @@ -36,10 +36,9 @@ include $(ERL_TOP)/lib/kernel/vsn.mk ifeq ($(USE_ESOCK), yes) PRE_LOADED_ERL_ESOCK_MODULES = \ socket \ - net + prim_net else -PRE_LOADED_ERL_ESOCK_MODULES = \ - net +PRE_LOADED_ERL_ESOCK_MODULES = endif PRE_LOADED_ERL_MODULES = \ @@ -82,9 +81,9 @@ APP_FILE= erts.app APP_SRC= $(APP_FILE).src APP_TARGET= $(STATIC_EBIN)/$(APP_FILE) ifeq ($(USE_ESOCK), yes) -APP_ESOCK_MODS= net, socket +APP_ESOCK_MODS= prim_net, socket else -APP_ESOCK_MODS= net +APP_ESOCK_MODS= endif @@ -96,6 +95,15 @@ ERL_COMPILE_FLAGS += +debug_info -I$(KERNEL_SRC) -I$(KERNEL_INCLUDE) DIA_PLT = erts-preloaded.plt DIA_ANALYSIS = $(basename $(DIA_PLT)).dialyzer_analysis +ifeq ($(DIAW_EH),true) +DIA_WARNINGS += -Werror_handling +endif +ifeq ($(DIAW_US),true) +DIA_WARNINGS += -Wunderspecs +endif +ifeq ($(DIAW_UR),true) +DIA_WARNINGS += -Wunmatched_returns +endif debug opt: $(TARGET_FILES) @@ -145,6 +153,7 @@ dialyzer: $(DIA_PLT) @echo "Running dialyzer on $(basename $(DIA_PLT))" @dialyzer --plt $< \ ../ebin \ + $(DIA_WARNINGS) \ --verbose # diff --git a/erts/preloaded/src/erl_init.erl b/erts/preloaded/src/erl_init.erl index d209c4033b..dadf7dda6f 100644 --- a/erts/preloaded/src/erl_init.erl +++ b/erts/preloaded/src/erl_init.erl @@ -35,7 +35,8 @@ start(Mod, BootArgs) -> erl_tracer:on_load(), prim_buffer:on_load(), prim_file:on_load(), - conditional_load(socket, [socket, net]), % socket:on_load(), net:on_load(), + %% socket:on_load(), prim_net:on_load(), + conditional_load(socket, [socket, prim_net]), %% Proceed to the specified boot module run(Mod, boot, BootArgs). @@ -49,7 +50,9 @@ run(M, F, A) -> end. conditional_load(CondMod, Mods2Load) -> - conditional_load(CondMod, erlang:loaded(), Mods2Load). + Loaded = erlang:loaded(), + %% erlang:display({?MODULE, conditional_load, Loaded}), + conditional_load(CondMod, Loaded, Mods2Load). conditional_load(_CondMod, [], _Mods2LOad) -> ok; diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl index 1aa5d85c64..1982424191 100644 --- a/erts/preloaded/src/prim_file.erl +++ b/erts/preloaded/src/prim_file.erl @@ -34,6 +34,7 @@ -export([read_link/1, read_link_all/1, read_link_info/1, read_link_info/2, read_file_info/1, read_file_info/2, + read_handle_info/1, read_handle_info/2, write_file_info/2, write_file_info/3]). -export([list_dir/1, list_dir_all/1]). @@ -497,6 +498,8 @@ get_handle_nif(_FileRef) -> erlang:nif_error(undef). delayed_close_nif(_FileRef) -> erlang:nif_error(undef). +read_handle_info_nif(_FileRef) -> + erlang:nif_error(undef). %% %% Quality-of-life helpers @@ -598,20 +601,37 @@ read_link_info(Name, Opts) -> read_info_1(Name, FollowLinks, TimeType) -> try case read_info_nif(encode_path(Name), FollowLinks) of - {error, Reason} -> - {error, Reason}; - FileInfo -> - CTime = from_posix_seconds(FileInfo#file_info.ctime, TimeType), - MTime = from_posix_seconds(FileInfo#file_info.mtime, TimeType), - ATime = from_posix_seconds(FileInfo#file_info.atime, TimeType), - {ok, FileInfo#file_info{ ctime = CTime, - mtime = MTime, - atime = ATime }} + {error, Reason} -> {error, Reason}; + FileInfo -> {ok, adjust_times(FileInfo, TimeType)} + end + catch + error:_ -> {error, badarg} + end. + +read_handle_info(Fd) -> + read_handle_info_1(Fd, local). +read_handle_info(Fd, Opts) -> + read_handle_info_1(Fd, proplist_get_value(time, Opts, local)). + +read_handle_info_1(Fd, TimeType) -> + try + #{ handle := FRef } = get_fd_data(Fd), + case read_handle_info_nif(FRef) of + {error, Reason} -> {error, Reason}; + FileInfo -> {ok, adjust_times(FileInfo, TimeType)} end catch error:_ -> {error, badarg} end. +adjust_times(FileInfo, TimeType) -> + CTime = from_posix_seconds(FileInfo#file_info.ctime, TimeType), + MTime = from_posix_seconds(FileInfo#file_info.mtime, TimeType), + ATime = from_posix_seconds(FileInfo#file_info.atime, TimeType), + FileInfo#file_info{ ctime = CTime, + mtime = MTime, + atime = ATime }. + write_file_info(Filename, Info) -> write_file_info_1(Filename, Info, local). write_file_info(Filename, Info, Opts) -> diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl index 374facb2a3..4dab3de006 100644 --- a/erts/preloaded/src/prim_inet.erl +++ b/erts/preloaded/src/prim_inet.erl @@ -427,7 +427,7 @@ accept_opts(L, S, FamilyOpts) -> case getopts( L, - [active, nodelay, keepalive, delay_send, priority] + [active, nodelay, keepalive, delay_send, priority, linger] ++ FamilyOpts) of {ok, Opts} -> diff --git a/erts/preloaded/src/net.erl b/erts/preloaded/src/prim_net.erl index 13d2e3a117..107043d1aa 100644 --- a/erts/preloaded/src/net.erl +++ b/erts/preloaded/src/prim_net.erl @@ -18,7 +18,7 @@ %% %CopyrightEnd% %% --module(net). +-module(prim_net). -compile(no_native). @@ -31,22 +31,14 @@ -export([ gethostname/0, - getnameinfo/1, getnameinfo/2, - getaddrinfo/1, getaddrinfo/2, + getnameinfo/2, + getaddrinfo/2, if_name2index/1, if_index2name/1, if_names/0 ]). -%% Deprecated functions from the "old" net module --export([call/4, - cast/4, - broadcast/3, - ping/1, - relay/1, - sleep/1]). - -export_type([ address_info/0, name_info/0, @@ -59,13 +51,6 @@ network_interface_index/0 ]). --deprecated({call, 4, eventually}). --deprecated({cast, 4, eventually}). --deprecated({broadcast, 3, eventually}). --deprecated({ping, 1, eventually}). --deprecated({relay, 1, eventually}). --deprecated({sleep, 1, eventually}). - -type name_info_flags() :: [name_info_flag()|name_info_flag_ext()]. -type name_info_flag() :: namereqd | @@ -88,21 +73,6 @@ %% =========================================================================== %% -%% D E P R E C A T E D F U N C T I O N S -%% -%% =========================================================================== - -call(N,M,F,A) -> rpc:call(N,M,F,A). -cast(N,M,F,A) -> rpc:cast(N,M,F,A). -broadcast(M,F,A) -> rpc:eval_everywhere(M,F,A). -ping(Node) -> net_adm:ping(Node). -sleep(T) -> receive after T -> ok end. -relay(X) -> slave:relay(X). - - - -%% =========================================================================== -%% %% Administrative and utility API %% %% =========================================================================== @@ -117,7 +87,7 @@ on_load() -> Extra :: map(). on_load(Extra) -> - ok = erlang:load_nif(atom_to_list(?MODULE), Extra). + ok = erlang:load_nif(atom_to_list(net), Extra). -spec info() -> list(). @@ -159,14 +129,6 @@ gethostname() -> %% %% --spec getnameinfo(SockAddr) -> {ok, Info} | {error, Reason} when - SockAddr :: socket:sockaddr(), - Info :: name_info(), - Reason :: term(). - -getnameinfo(SockAddr) -> - getnameinfo(SockAddr, undefined). - -spec getnameinfo(SockAddr, Flags) -> {ok, Info} | {error, Reason} when SockAddr :: socket:sockaddr(), Flags :: name_info_flags() | undefined, @@ -178,44 +140,18 @@ getnameinfo(SockAddr, [] = _Flags) -> getnameinfo(#{family := Fam, addr := _Addr} = SockAddr, Flags) when ((Fam =:= inet) orelse (Fam =:= inet6)) andalso (is_list(Flags) orelse (Flags =:= undefined)) -> - nif_getnameinfo((catch ensure_sockaddr(SockAddr)), Flags); + nif_getnameinfo(socket:ensure_sockaddr(SockAddr), Flags); getnameinfo(#{family := Fam, path := _Path} = SockAddr, Flags) when (Fam =:= local) andalso (is_list(Flags) orelse (Flags =:= undefined)) -> nif_getnameinfo(SockAddr, Flags). -%% This function is intended to "handle" the case when the user -%% has built their (OTP) system with "--disable-esock". -%% That means the socket module does not exist. This is not really -%% a problem since the nif_getnameinfo won't work either (since -%% the nif file is not part of the system). The result of calling -%% getnameinfo will be a undef exception (erlang:nif_error(undef)). -%% -%% The only functions in this module that actually work in this case -%% (--disable-esock) is the depricated stuff (call, cast, ...). -%% -ensure_sockaddr(SockAddr) -> - try socket:ensure_sockaddr(SockAddr) - catch - error:undef:_ -> - undefined - end. - %% =========================================================================== %% %% getaddrinfo - Network address and service translation %% %% There is also a "hint" argument that we "at some point" should implement. --spec getaddrinfo(Host) -> {ok, Info} | {error, Reason} when - Host :: string(), - Info :: [address_info()], - Reason :: term(). - -getaddrinfo(Host) when is_list(Host) -> - getaddrinfo(Host, undefined). - - -spec getaddrinfo(Host, undefined) -> {ok, Info} | {error, Reason} when Host :: string(), Info :: [address_info()], diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index ae1ffdb4ac..07e720c44d 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, - info/0, - supports/0, supports/1, supports/2, supports/3, - ensure_sockaddr/1 + + ensure_sockaddr/1, + + debug/1, + %% command/1, + info/0, info/1, + supports/0, supports/1, supports/2, supports/3 ]). -export([ @@ -63,6 +67,12 @@ select_ref/0, select_info/0, + socket_counters/0, + socket_counter/0, + socket_info/0, + + %% command/0, + domain/0, type/0, protocol/0, @@ -135,6 +145,27 @@ ]). +%% 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 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. @@ -282,7 +313,8 @@ path := binary() | string()}. -type sockaddr_in4() :: #{family := inet, port := port_number(), - addr := any | loopback | ip4_address()}. + %% The 'broadcast' here is the "limited broadcast" + addr := any | broadcast | loopback | ip4_address()}. -type sockaddr_in6() :: #{family := inet6, port := port_number(), addr := any | loopback | ip6_address(), @@ -303,7 +335,7 @@ -define(SOCKADDR_IN6_DEFAULTS, ?SOCKADDR_IN6_DEFAULTS(any)). -define(SOCKADDR_IN6_DEFAULT(A), (?SOCKADDR_IN6_DEFAULTS(A))#{family => inet6}). -%% otp - The option is internal to our (OTP) imeplementation. +%% otp - This option is internal to our (OTP) implementation. %% socket - The socket layer (SOL_SOCKET). %% ip - The IP layer (SOL_IP or is it IPPROTO_IP?). %% ipv6 - The IPv6 layer (SOL_IPV6). @@ -311,6 +343,7 @@ %% udp - The UDP (User Datagram Protocol) layer (IPPROTO_UDP). %% sctp - The SCTP (Stream Control Transmission Protocol) layer (IPPROTO_SCTP). %% Int - Raw level, sent down and used "as is". +%% Its up to the caller to make sure this is correct! -type sockopt_level() :: otp | socket | ip | ipv6 | tcp | udp | sctp | @@ -594,11 +627,11 @@ -opaque select_tag() :: atom(). -opaque select_ref() :: reference(). --record(select_info, {tag :: select_tag(), ref :: select_ref()}). +%% -record(select_info, {tag :: select_tag(), ref :: select_ref()}). --type select_info() :: #select_info{}. +-type select_info() :: {select_info, select_tag(), select_ref()}. --define(SELECT_INFO(T, R), #select_info{tag = T, ref = R}). +-define(SELECT_INFO(T, R), {select_info, T, R}). -define(SELECT(T, R), {select, ?SELECT_INFO(T, R)}). @@ -861,12 +894,46 @@ on_load(Extra) -> --spec info() -> list(). +-spec info() -> map(). 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). + + + +%% =========================================================================== +%% +%% 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). + + %% =========================================================================== %% @@ -1081,19 +1148,25 @@ open(Domain, Type, Protocol, Extra) when is_map(Extra) -> %% %% bind - bind a name to a socket %% +%% Note that Addr can only have the value of broadcast *if* Domain =:= inet! +%% -spec bind(Socket, Addr) -> ok | {error, Reason} when Socket :: socket(), - Addr :: any | loopback | sockaddr(), + Addr :: any | broadcast | loopback | sockaddr(), Reason :: term(). bind(#socket{ref = SockRef}, Addr) - when ((Addr =:= any) orelse (Addr =:= loopback)) -> + when ((Addr =:= any) orelse + (Addr =:= broadcast) orelse + (Addr =:= loopback)) -> try which_domain(SockRef) of inet -> nif_bind(SockRef, ?SOCKADDR_IN4_DEFAULT(Addr)); - inet6 -> - nif_bind(SockRef, ?SOCKADDR_IN6_DEFAULT(Addr)) + inet6 when (Addr =:= any) orelse (Addr =:= loopback) -> + nif_bind(SockRef, ?SOCKADDR_IN6_DEFAULT(Addr)); + _ -> + einval() catch %% <WIN32-TEMPORARY> error:notsup:S -> @@ -1236,7 +1309,7 @@ connect(#socket{ref = SockRef}, #{family := Fam} = SockAddr, Timeout) ((Timeout =:= nowait) orelse (Timeout =:= infinity) orelse is_integer(Timeout)) -> TS = timestamp(Timeout), - case nif_connect(SockRef, SockAddr) of + case nif_connect(SockRef, ensure_sockaddr(SockAddr)) of ok -> %% Connected! ok; @@ -1494,7 +1567,7 @@ do_send(SockRef, Data, EFlags, Timeout) -> ok | {error, Reason} when Socket :: socket(), Data :: binary(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Reason :: term(). sendto(Socket, Data, Dest) -> @@ -1503,7 +1576,7 @@ sendto(Socket, Data, Dest) -> -spec sendto(Socket, Data, Dest, Flags) -> ok | {error, Reason} when Socket :: socket(), Data :: binary(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Flags :: send_flags(), Reason :: term() ; (Socket, Data, Dest, Timeout :: nowait) -> ok | @@ -1511,13 +1584,13 @@ sendto(Socket, Data, Dest) -> {error, Reason} when Socket :: socket(), Data :: iodata(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), SelectInfo :: select_info(), Reason :: term() ; (Socket, Data, Dest, Timeout) -> ok | {error, Reason} when Socket :: socket(), Data :: iodata(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Timeout :: timeout(), Reason :: term(). @@ -1532,14 +1605,14 @@ sendto(Socket, Data, Dest, Timeout) -> {error, Reason} when Socket :: socket(), Data :: binary(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Flags :: send_flags(), SelectInfo :: select_info(), Reason :: term() ; (Socket, Data, Dest, Flags, Timeout) -> ok | {error, Reason} when Socket :: socket(), Data :: binary(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Flags :: send_flags(), Timeout :: timeout(), Reason :: term(). @@ -1547,15 +1620,6 @@ sendto(Socket, Data, Dest, Timeout) -> sendto(Socket, Data, Dest, Flags, Timeout) when is_list(Data) -> Bin = erlang:list_to_binary(Data), sendto(Socket, Bin, Dest, Flags, Timeout); -sendto(#socket{ref = SockRef}, Data, Dest, Flags, Timeout) - when is_binary(Data) andalso - (Dest =:= null) andalso - is_list(Flags) andalso - ((Timeout =:= nowait) orelse - (Timeout =:= infinity) orelse - (is_integer(Timeout) andalso (Timeout > 0))) -> - EFlags = enc_send_flags(Flags), - do_sendto(SockRef, Data, Dest, EFlags, Timeout); sendto(#socket{ref = SockRef}, Data, #{family := Fam} = Dest, Flags, Timeout) when is_binary(Data) andalso ((Fam =:= inet) orelse (Fam =:= inet6) orelse (Fam =:= local)) andalso @@ -1564,7 +1628,7 @@ sendto(#socket{ref = SockRef}, Data, #{family := Fam} = Dest, Flags, Timeout) (Timeout =:= infinity) orelse (is_integer(Timeout) andalso (Timeout > 0))) -> EFlags = enc_send_flags(Flags), - do_sendto(SockRef, Data, Dest, EFlags, Timeout). + do_sendto(SockRef, Data, ensure_sockaddr(Dest), EFlags, Timeout). do_sendto(SockRef, Data, Dest, EFlags, Timeout) -> TS = timestamp(Timeout), @@ -1755,8 +1819,12 @@ do_sendmsg_rest([B|IOVec], Written) -> ensure_msghdr(#{ctrl := []} = M) -> ensure_msghdr(maps:remove(ctrl, M)); -ensure_msghdr(#{iov := IOV} = M) when is_list(IOV) andalso (IOV =/= []) -> - M#{iov := erlang:iolist_to_iovec(IOV)}; +ensure_msghdr(#{iov := IOV, addr := Addr} = M) + when is_list(IOV) andalso (IOV =/= []) -> + M#{iov => erlang:iolist_to_iovec(IOV), addr => ensure_sockaddr(Addr)}; +ensure_msghdr(#{iov := IOV} = M) + when is_list(IOV) andalso (IOV =/= []) -> + M#{iov => erlang:iolist_to_iovec(IOV)}; ensure_msghdr(_) -> einval(). @@ -2617,7 +2685,7 @@ peername(#socket{ref = SockRef}) -> SelectInfo :: select_info(), Reason :: term(). -cancel(#socket{ref = SockRef}, #select_info{tag = Tag, ref = Ref}) -> +cancel(#socket{ref = SockRef}, ?SELECT_INFO(Tag, Ref)) -> cancel(SockRef, Tag, Ref). @@ -2628,17 +2696,17 @@ cancel(#socket{ref = SockRef}, #select_info{tag = Tag, ref = Ref}) -> %% %% =========================================================================== --spec enc_domain(Domain) -> non_neg_integer() when - Domain :: domain(). +%% -spec enc_domain(Domain) -> non_neg_integer() when +%% Domain :: domain(). enc_domain(local) -> ?SOCKET_DOMAIN_LOCAL; enc_domain(inet) -> ?SOCKET_DOMAIN_INET; enc_domain(inet6) -> ?SOCKET_DOMAIN_INET6; enc_domain(Domain) -> invalid_domain(Domain). --spec enc_type(Domain, Type) -> non_neg_integer() when - Domain :: domain(), - Type :: type(). +%% -spec enc_type(Domain, Type) -> non_neg_integer() when +%% Domain :: domain(), +%% Type :: type(). %% What combos are valid? enc_type(_, stream) -> ?SOCKET_TYPE_STREAM; @@ -3308,10 +3376,12 @@ enc_sockopt_key(otp = L, Opt, _, _, _, _) -> %% +++ SOCKET socket options +++ enc_sockopt_key(socket = _L, acceptconn = _Opt, get = _Dir, _D, _T, _P) -> ?SOCKET_OPT_SOCK_ACCEPTCONN; +enc_sockopt_key(socket = L, acceptconn = Opt, Dir, _D, _T, _P) -> + not_supported({L, Opt, Dir}); enc_sockopt_key(socket = L, acceptfilter = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); -%% Before linux 3.8, this socket option could be set. -%% Maximum size of buffer for name: IFNAMSZIZ +%% Before linux 3.8, this socket option could be set but not get. +%% Maximum size of buffer for name: IFNAMSIZ %% So, we let the implementation decide. enc_sockopt_key(socket = _L, bindtodevice = _Opt, _Dir, _D, _T, _P) -> ?SOCKET_OPT_SOCK_BINDTODEVICE; @@ -3845,6 +3915,12 @@ error(Reason) -> nif_info() -> erlang:nif_error(undef). +nif_info(_SRef) -> + erlang:nif_error(undef). + +nif_command(_Command) -> + erlang:nif_error(undef). + nif_supports(_Key) -> erlang:nif_error(undef). |