This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 63cd44e5e1 net/usrsock: forward FIONBIO to socket level 63cd44e5e1 is described below commit 63cd44e5e16e26d916a24139f12b23194c3f372c Author: chao an <anc...@xiaomi.com> AuthorDate: Wed Aug 31 22:22:21 2022 +0800 net/usrsock: forward FIONBIO to socket level fix usrsock nonblock connect test break: apps/examples/usrsocktest/usrsocktest_noblock_connect.c: ... 157 TEST(no_block_connect, delayed_connect) 158 { ... 190 ret = fcntl(sd, F_SETFL, flags | O_NONBLOCK); ... 204 ret = connect(sd, (FAR const struct sockaddr *)&addr, sizeof(addr)); 205 TEST_ASSERT_EQUAL(-1, ret); 206 TEST_ASSERT_EQUAL(EINPROGRESS, errno); should goahead to socket level: nuttx/net/netdev/netdev_ioctl.c: ... 1755 int psock_vioctl(FAR struct socket *psock, int cmd, va_list ap) 1756 { ... 1771 ret = netdev_ioctl(psock, cmd, arg); ... 1775 if (ret == -ENOTTY) 1776 { 1777 ret = netdev_file_ioctl(psock, cmd, arg); 1778 } ... Signed-off-by: chao an <anc...@xiaomi.com> --- net/usrsock/usrsock_ioctl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/usrsock/usrsock_ioctl.c b/net/usrsock/usrsock_ioctl.c index 66bf83242e..91b252aaad 100644 --- a/net/usrsock/usrsock_ioctl.c +++ b/net/usrsock/usrsock_ioctl.c @@ -31,6 +31,7 @@ #include <errno.h> #include <debug.h> +#include <sys/ioctl.h> #include <sys/socket.h> #include <nuttx/net/net.h> #include <nuttx/net/usrsock.h> @@ -173,6 +174,15 @@ int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg, int ret; + /* Bypass FIONBIO to socket level, + * since the usrsock server always put the socket in nonblocking mode. + */ + + if (cmd == FIONBIO) + { + return -ENOTTY; + } + net_lock(); if (conn->state == USRSOCK_CONN_STATE_UNINITIALIZED ||