From 875825874d4a8d52ec5cc593f5024afc696c29df Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 31 Jan 2019 11:34:03 +0100 Subject: [socket-nif] nosup expection of win32 and type(s) replacements The nif callback functions (nif_open) now instead cause an 'nosup' exception if called (instead of badarg). The basic type uint16_t, uint32_t and int32_t (C99) replaced "own" (that is, defined by "us") types Uint16, Uint32 and Sint32. The point of this is that our Windows build system seems to be a bit lacking when it comes to types... Removed "some stuff" that was if-defed. Different solution when win32 support for sockets has been improved. Make sure the socket_*.c util modules are not included in the building for windows. OTP-15526 --- erts/preloaded/src/socket.erl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'erts/preloaded/src/socket.erl') diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 80ccd7ea10..287ef1d791 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -1055,6 +1055,10 @@ open(Domain, Type, Protocol0, Extra) when is_map(Extra) -> catch throw:T -> T; + %% + error:nosup:S -> + erlang:raise(error, nosup, S); + %% error:Reason -> {error, Reason} end. @@ -1088,6 +1092,10 @@ bind(#socket{ref = SockRef}, Addr) inet6 -> nif_bind(SockRef, ?SOCKADDR_IN6_DEFAULT(Addr)) catch + %% + error:nosup:S -> + erlang:raise(error, nosup, S); + %% throw:ERROR -> ERROR end; @@ -1097,6 +1105,10 @@ bind(#socket{ref = SockRef} = _Socket, Addr) when is_map(Addr) -> nif_bind(SockRef, ensure_sockaddr(Addr)) end catch + %% + error:nosup:S -> + erlang:raise(error, nosup, S); + %% throw:ERROR -> ERROR end. @@ -1131,6 +1143,10 @@ bind(#socket{ref = SockRef}, Addrs, Action) nif_bind(SockRef, Addrs, Action) end catch + %% + error:nosup:S -> + erlang:raise(error, nosup, S); + %% throw:ERROR -> ERROR end. @@ -2135,6 +2151,10 @@ shutdown(#socket{ref = SockRef}, How) -> catch throw:T -> T; + %% + error:nosup:S -> + erlang:raise(error, nosup, S); + %% error:Reason -> {error, Reason} end. @@ -2207,6 +2227,10 @@ setopt(#socket{ref = SockRef}, Level, Key, Value) -> catch throw:T -> T; + %% + error:nosup:S -> + erlang:raise(error, nosup, S); + %% error:Reason -> {error, Reason} % Process more? end. @@ -2289,6 +2313,10 @@ getopt(#socket{ref = SockRef}, Level, Key) -> catch throw:E:_S -> E; + %% + error:nosup:S -> + erlang:raise(error, nosup, S); + %% error:Reason:_Stack -> {error, Reason} % Process more? end. -- cgit v1.2.3