From e293ad1b08b2f937555a102e6f3b4336574773c8 Mon Sep 17 00:00:00 2001 From: Serge Aleynikov Date: Wed, 30 Dec 2015 13:29:34 -0500 Subject: Assign externally open fd to gen_tcp (UDS support) When a AF_LOCAL file descriptor is created externally (e.g. Unix Domain Socket) and passed to `gen_tcp:listen(0, [{fd, FD}])`, the implementation incorrectly assigned the address family to be equal to `inet`, which in the inet_drv driver translated to AF_INET instead of AF_LOCAL (or AF_UNIX), and an `einval` error code was returned. This patch fixes this problem such that the file descriptors of the `local` address family are supported in the inet:fdopen/5, gen_tcp:connect/3, gen_tcp:listen/2, gen_udp:open/2 calls --- lib/kernel/doc/src/gen_tcp.xml | 7 +++++++ lib/kernel/doc/src/gen_udp.xml | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml index 6a19e76c4f..20a13782ca 100644 --- a/lib/kernel/doc/src/gen_tcp.xml +++ b/lib/kernel/doc/src/gen_tcp.xml @@ -132,6 +132,13 @@ do_recv(Sock, Bs) ->

Set up the socket for IPv6.

+ local + +

Set up the socket for local address family. This option is only + valid together with {fd, integer()} when the file descriptor + is of local address family (e.g. a Unix Domain Socket)

+
+ {port, Port}

Specify which local port number to use.

diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml index 79cd87dcef..72f25d8d3f 100644 --- a/lib/kernel/doc/src/gen_udp.xml +++ b/lib/kernel/doc/src/gen_udp.xml @@ -101,6 +101,13 @@

Set up the socket for IPv4.

+ local + +

Set up the socket for local address family. This option is only + valid together with {fd, integer()} when the file descriptor + is of local address family (e.g. a Unix Domain Socket)

+
+ {udp_module, module()}

Override which callback module is used. Defaults to -- cgit v1.2.3