net: Remove psock_fcntl related code

since the nonblocking mode set through psock_ioctl now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2022-03-04 16:13:17 +08:00
committed by Petro Karashchenko
parent 19e796305a
commit b2c86f808d
5 changed files with 80 additions and 318 deletions
+77 -2
View File
@@ -1472,6 +1472,73 @@ static int netdev_rt_ioctl(FAR struct socket *psock, int cmd,
}
#endif
/****************************************************************************
* Name: netdev_file_ioctl
*
* Description:
* Perform file 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_file_ioctl(FAR struct socket *psock, int cmd,
unsigned long arg)
{
int ret;
switch (cmd)
{
case FIONBIO:
{
FAR struct socket_conn_s *conn = psock->s_conn;
FAR int *nonblock = (FAR int *)(uintptr_t)arg;
sockcaps_t sockcaps;
/* Non-blocking is the only configurable option. And it applies
* only Unix domain sockets and to read operations on TCP/IP
* and UDP/IP sockets when read-ahead is enabled.
*/
DEBUGASSERT(psock->s_sockif != NULL &&
psock->s_sockif->si_sockcaps != NULL);
sockcaps = psock->s_sockif->si_sockcaps(psock);
if ((sockcaps & SOCKCAP_NONBLOCKING) != 0)
{
if (nonblock && *nonblock)
{
conn->s_flags |= _SF_NONBLOCK;
}
else
{
conn->s_flags &= ~_SF_NONBLOCK;
}
ret = OK;
}
else
{
nerr("ERROR: Non-blocking not supported for this socket\n");
ret = -ENOSYS;
}
}
default:
ret = -ENOTTY;
break;
}
return ret;
}
/****************************************************************************
* Name: netdev_ioctl
*
@@ -1673,13 +1740,21 @@ int psock_vioctl(FAR struct socket *psock, int cmd, va_list ap)
arg = va_arg(ap, unsigned long);
/* Check for a USRSOCK ioctl command */
/* Check for socket specific ioctl command */
ret = netdev_ioctl(psock, cmd, arg);
/* Check for file ioctl command */
if (ret == -ENOTTY)
{
/* Check for a standard network IOCTL command. */
ret = netdev_file_ioctl(psock, cmd, arg);
}
/* Check for a standard network IOCTL command. */
if (ret == -ENOTTY)
{
ret = netdev_ifr_ioctl(psock, cmd, (FAR struct ifreq *)(uintptr_t)arg);
}