aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-10-11 10:31:54 +0200
committerFredrik Gustafsson <[email protected]>2013-10-11 10:31:54 +0200
commitc63d1054f837a935cb441fa23021bb8913dd8a12 (patch)
tree78da1511c8a96f71b23371a3b51e0b500328abea
parent8a5f2c73d9664c5a170827cea10214019490e923 (diff)
parent442d802ae4b8a75d69c37d0d5251d4198c642624 (diff)
downloadotp-c63d1054f837a935cb441fa23021bb8913dd8a12.tar.gz
otp-c63d1054f837a935cb441fa23021bb8913dd8a12.tar.bz2
otp-c63d1054f837a935cb441fa23021bb8913dd8a12.zip
Merge branch 'ali/fix-inet-typespec/OTP-11377' into maint
* ali/fix-inet-typespec/OTP-11377: Fix the typespec for the inet:ifget/2 and inet:ifget/3 return value
-rw-r--r--lib/kernel/src/inet.erl15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index 27f085c3aa..d4c78505da 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -120,6 +120,17 @@
'addr' | 'broadaddr' | 'dstaddr' |
'mtu' | 'netmask' | 'flags' |'hwaddr'.
+-type if_getopt_result() ::
+ {'addr', ip_address()} |
+ {'broadaddr', ip_address()} |
+ {'dstaddr', ip_address()} |
+ {'mtu', non_neg_integer()} |
+ {'netmask', ip_address()} |
+ {'flags', ['up' | 'down' | 'broadcast' | 'no_broadcast' |
+ 'pointtopoint' | 'no_pointtopoint' |
+ 'running' | 'multicast' | 'loopback']} |
+ {'hwaddr', ether_address()}.
+
-type address_family() :: 'inet' | 'inet6'.
-type socket_protocol() :: 'tcp' | 'udp' | 'sctp'.
-type socket_type() :: 'stream' | 'dgram' | 'seqpacket'.
@@ -266,13 +277,13 @@ getiflist() ->
-spec ifget(Socket :: socket(),
Name :: string() | atom(),
Opts :: [if_getopt()]) ->
- {'ok', [if_setopt()]} | {'error', posix()}.
+ {'ok', [if_getopt_result()]} | {'error', posix()}.
ifget(Socket, Name, Opts) ->
prim_inet:ifget(Socket, Name, Opts).
-spec ifget(Name :: string() | atom(), Opts :: [if_getopt()]) ->
- {'ok', [if_setopt()]} | {'error', posix()}.
+ {'ok', [if_getopt_result()]} | {'error', posix()}.
ifget(Name, Opts) ->
withsocket(fun(S) -> prim_inet:ifget(S, Name, Opts) end).