net: Finish FIONBIO default action if si_ioctl return OK

Continue the work: https://github.com/apache/nuttx/pull/6976

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-03-07 04:22:31 +08:00 committed by Petro Karashchenko
parent 815f40c8f1
commit 9f4a15110c

View File

@ -1462,10 +1462,10 @@ static int netdev_rt_ioctl(FAR struct socket *psock, int cmd,
#endif
/****************************************************************************
* Name: netdev_file_ioctl
* Name: netdev_ioctl
*
* Description:
* Perform file ioctl operations.
* Perform user private ioctl operations.
*
* Parameters:
* psock Socket structure
@ -1478,10 +1478,20 @@ static int netdev_rt_ioctl(FAR struct socket *psock, int cmd,
*
****************************************************************************/
static int netdev_file_ioctl(FAR struct socket *psock, int cmd,
static int netdev_ioctl(FAR struct socket *psock, int cmd,
unsigned long arg)
{
int ret = OK;
int ret = -ENOTTY;
if (psock->s_sockif && psock->s_sockif->si_ioctl)
{
ret = psock->s_sockif->si_ioctl(psock, cmd, arg);
}
if (ret != OK && ret != -ENOTTY)
{
return ret;
}
switch (cmd)
{
@ -1510,6 +1520,8 @@ static int netdev_file_ioctl(FAR struct socket *psock, int cmd,
{
conn->s_flags &= ~_SF_NONBLOCK;
}
ret = OK;
}
else
{
@ -1517,46 +1529,16 @@ static int netdev_file_ioctl(FAR struct socket *psock, int cmd,
ret = -ENOSYS;
}
}
break;
default:
ret = -ENOTTY;
break;
}
return ret;
}
/****************************************************************************
* Name: netdev_ioctl
*
* Description:
* Perform user private ioctl operations.
*
* Parameters:
* psock Socket structure
* cmd The ioctl command
* arg The argument of the ioctl cmd
*
* Return:
* >=0 on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
static int netdev_ioctl(FAR struct socket *psock, int cmd,
unsigned long arg)
{
if (psock->s_sockif && psock->s_sockif->si_ioctl)
{
return psock->s_sockif->si_ioctl(psock, cmd, arg);
}
else
{
return -ENOTTY;
}
}
/****************************************************************************
* Public Functions
****************************************************************************/
@ -1696,13 +1678,6 @@ int psock_vioctl(FAR struct socket *psock, int cmd, va_list ap)
ret = netdev_ioctl(psock, cmd, arg);
/* Check for file ioctl command */
if (ret == -ENOTTY)
{
ret = netdev_file_ioctl(psock, cmd, arg);
}
/* Check for a standard network IOCTL command. */
if (ret == -ENOTTY)