[fdio] Implement clone/unwrap for datagram sockets
Tests: Unclear how to test without netstack
Change-Id: I9891cd201ae54b96cec55226530cbd10fda081d1
diff --git a/system/ulib/fdio/bsdsocket.c b/system/ulib/fdio/bsdsocket.c
index 5296c34..2927aaa 100644
--- a/system/ulib/fdio/bsdsocket.c
+++ b/system/ulib/fdio/bsdsocket.c
@@ -244,8 +244,6 @@
return ERROR(ZX_ERR_NO_RESOURCES);
}
- io2->ioflag |= IOFLAG_SOCKET_CONNECTED;
-
if (flags & SOCK_NONBLOCK) {
io2->ioflag |= IOFLAG_NONBLOCK;
}
diff --git a/system/ulib/fdio/socket.c b/system/ulib/fdio/socket.c
index 15f36f8..1adf3a4 100644
--- a/system/ulib/fdio/socket.c
+++ b/system/ulib/fdio/socket.c
@@ -243,7 +243,7 @@
return total;
}
-static zx_status_t zxsio_clone_stream(fdio_t* io, zx_handle_t* handles, uint32_t* types) {
+static zx_status_t zxsio_clone(fdio_t* io, zx_handle_t* handles, uint32_t* types) {
// TODO: support unconnected sockets
if (!(io->ioflag & IOFLAG_SOCKET_CONNECTED)) {
return ZX_ERR_BAD_STATE;
@@ -257,7 +257,7 @@
return 1;
}
-static zx_status_t zxsio_unwrap_stream(fdio_t* io, zx_handle_t* handles, uint32_t* types) {
+static zx_status_t zxsio_unwrap(fdio_t* io, zx_handle_t* handles, uint32_t* types) {
// TODO: support unconnected sockets
if (!(io->ioflag & IOFLAG_SOCKET_CONNECTED)) {
return ZX_ERR_BAD_STATE;
@@ -772,11 +772,11 @@
.misc = zxsio_misc,
.close = zxsio_close,
.open = fdio_default_open,
- .clone = zxsio_clone_stream,
+ .clone = zxsio_clone,
.ioctl = zxsio_ioctl,
.wait_begin = zxsio_wait_begin_stream,
.wait_end = zxsio_wait_end_stream,
- .unwrap = zxsio_unwrap_stream,
+ .unwrap = zxsio_unwrap,
.posix_ioctl = zxsio_posix_ioctl_stream,
.get_vmo = fdio_default_get_vmo,
.get_token = fdio_default_get_token,
@@ -807,11 +807,11 @@
.misc = zxsio_misc,
.close = zxsio_close,
.open = fdio_default_open,
- .clone = fdio_default_clone,
+ .clone = zxsio_clone,
.ioctl = zxsio_ioctl,
.wait_begin = zxsio_wait_begin_dgram,
.wait_end = zxsio_wait_end_dgram,
- .unwrap = fdio_default_unwrap,
+ .unwrap = zxsio_unwrap,
.posix_ioctl = fdio_default_posix_ioctl, // not supported
.get_vmo = fdio_default_get_vmo,
.get_token = fdio_default_get_token,