net/local: Fix minor issues found in code reading

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-02-28 13:14:19 +08:00 committed by Alan Carvalho de Assis
parent 2f4e90b1e9
commit 155768bae3
14 changed files with 51 additions and 142 deletions

View file

@ -88,7 +88,7 @@ enum local_state_s
* connection structures:
*
* 1. Server. A SOCK_STREAM that only listens for and accepts
* connections from server.
* connections from client.
* 2. Client. A SOCK_STREAM peer that connects via the server.
* 3. Peer. A connected SOCK_STREAM that sends() and recvs() packets.
* May either be the client that connect with the server of the
@ -98,8 +98,7 @@ enum local_state_s
* And
*
* 4. Connectionless. Like a peer but using a connectionless datagram
* style of communication. SOCK_DRAM support has not yet been
* implemented.
* style of communication.
*/
struct devif_callback_s; /* Forward reference */

View file

@ -23,7 +23,6 @@
****************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL_STREAM)
#include <string.h>
#include <errno.h>
@ -99,7 +98,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
FAR socklen_t *addrlen, FAR struct socket *newsock,
int flags)
{
FAR struct local_conn_s *server;
FAR struct local_conn_s *server = psock->s_conn;
FAR struct local_conn_s *conn;
FAR dq_entry_t *waiter;
bool nonblock = !!(flags & SOCK_NONBLOCK);
@ -116,12 +115,6 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
return -EOPNOTSUPP;
}
/* Verify that a valid memory block has been provided to receive the
* address
*/
server = psock->s_conn;
if (server->lc_proto != SOCK_STREAM ||
server->lc_state != LOCAL_STATE_LISTENING)
{
@ -137,7 +130,6 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
*/
waiter = dq_remfirst(&server->u.server.lc_waiters);
if (waiter)
{
conn = container_of(waiter, struct local_conn_s,
@ -192,5 +184,3 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
}
}
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL_STREAM */

View file

@ -23,7 +23,6 @@
****************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
#include <sys/socket.h>
#include <string.h>
@ -38,7 +37,7 @@
****************************************************************************/
/****************************************************************************
* Name: local_bind
* Name: psock_local_bind
*
* Description:
* This function implements the low-level parts of the standard local
@ -49,7 +48,7 @@
int psock_local_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen)
{
FAR struct local_conn_s *conn;
FAR struct local_conn_s *conn = psock->s_conn;
FAR const struct sockaddr_un *unaddr =
(FAR const struct sockaddr_un *)addr;
@ -60,8 +59,6 @@ int psock_local_bind(FAR struct socket *psock,
return -EINVAL;
}
conn = psock->s_conn;
/* Save the address family */
conn->lc_proto = psock->s_type;
@ -95,5 +92,3 @@ int psock_local_bind(FAR struct socket *psock,
conn->lc_state = LOCAL_STATE_BOUND;
return OK;
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View file

@ -23,7 +23,6 @@
****************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
#include <string.h>
#include <assert.h>
@ -347,5 +346,3 @@ void local_subref(FAR struct local_conn_s *conn)
local_release(conn);
}
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View file

@ -40,8 +40,6 @@
#include "socket/socket.h"
#include "local/local.h"
#ifdef CONFIG_NET_LOCAL_STREAM
/****************************************************************************
* Private Functions
****************************************************************************/
@ -94,7 +92,6 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
{
nerr("ERROR: Failed to create FIFOs for %s: %d\n",
client->lc_path, ret);
return ret;
}
@ -107,7 +104,6 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
{
nerr("ERROR: Failed to open write-only FIFOs for %s: %d\n",
client->lc_path, ret);
goto errout_with_fifos;
}
@ -118,7 +114,6 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
{
nerr("ERROR: Failed to alloc accept conn %s: %d\n",
client->lc_path, ret);
goto errout_with_outfd;
}
@ -129,9 +124,8 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
ret = local_open_client_rx(client, nonblock);
if (ret < 0)
{
nerr("ERROR: Failed to open write-only FIFOs for %s: %d\n",
nerr("ERROR: Failed to open read-only FIFOs for %s: %d\n",
client->lc_path, ret);
goto errout_with_conn;
}
@ -220,15 +214,13 @@ int32_t local_generate_instance_id(void)
int psock_local_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr)
{
FAR struct local_conn_s *client;
FAR struct local_conn_s *client = psock->s_conn;
FAR struct sockaddr_un *unaddr = (FAR struct sockaddr_un *)addr;
FAR const char *unpath = unaddr->sun_path;
FAR struct local_conn_s *conn = NULL;
uint8_t type = LOCAL_TYPE_PATHNAME;
struct stat buf;
int ret;
client = psock->s_conn;
int ret = OK;
if (client->lc_state == LOCAL_STATE_ACCEPT ||
client->lc_state == LOCAL_STATE_CONNECTED)
@ -247,9 +239,9 @@ int psock_local_connect(FAR struct socket *psock,
net_lock();
while ((conn = local_nextconn(conn)) != NULL)
{
/* Slef found, continue */
/* Self found, continue */
if (conn == psock->s_conn)
if (conn == client)
{
continue;
}
@ -272,8 +264,6 @@ int psock_local_connect(FAR struct socket *psock,
conn->lc_type == type && conn->lc_proto == SOCK_STREAM &&
strncmp(conn->lc_path, unpath, UNIX_PATH_MAX - 1) == 0)
{
ret = OK;
/* Bind the address and protocol */
client->lc_type = conn->lc_type;
@ -307,5 +297,3 @@ int psock_local_connect(FAR struct socket *psock,
ret = nx_stat(unpath, &buf, 1);
return ret < 0 ? ret : -ECONNREFUSED;
}
#endif /* CONFIG_NET_LOCAL_STREAM */

View file

@ -23,7 +23,6 @@
****************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
#include <sys/stat.h>
#include <sys/ioctl.h>
@ -156,7 +155,7 @@ static bool local_fifo_exists(FAR const char *path)
* In that case, we will return false and mkfifo() will fail.
*/
return (bool)S_ISFIFO(buf.st_mode);
return S_ISFIFO(buf.st_mode);
}
/****************************************************************************
@ -478,12 +477,12 @@ int local_release_fifos(FAR struct local_conn_s *conn)
int ret1;
int ret2;
/* Destroy the client-to-server FIFO if it exists. */
/* Destroy the server-to-client FIFO if it exists. */
local_sc_name(conn, path);
ret1 = local_release_fifo(path);
/* Destroy the server-to-client FIFO if it exists. */
/* Destroy the client-to-server FIFO if it exists. */
local_cs_name(conn, path);
ret2 = local_release_fifo(path);
@ -610,7 +609,7 @@ int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock)
local_cs_name(server, path);
/* Then open the file for write-only access */
/* Then open the file for read-only access */
ret = local_rx_open(server, path, nonblock);
if (ret == OK)
@ -627,7 +626,7 @@ int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock)
* Name: local_open_server_tx
*
* Description:
* Only the server-side of the server-to-client FIFO.
* Open the server-side of the server-to-client FIFO.
*
****************************************************************************/
@ -640,7 +639,7 @@ int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock)
local_sc_name(server, path);
/* Then open the file for read-only access */
/* Then open the file for write-only access */
ret = local_tx_open(server, path, nonblock);
if (ret == OK)
@ -657,7 +656,7 @@ int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock)
* Name: local_open_receiver
*
* Description:
* Only the receiving side of the half duplex FIFO.
* Open the receiving side of the half duplex FIFO.
*
****************************************************************************/
@ -679,7 +678,6 @@ int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock)
/* Policy: Free FIFO resources when the buffer is empty. */
ret = local_set_policy(&conn->lc_infile, 1);
if (ret == 0)
{
/* Set POLLOUT threshold bigger than preamble len.
@ -700,7 +698,7 @@ int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock)
* Name: local_open_sender
*
* Description:
* Only the sending side of the half duplex FIFO.
* Open the sending side of the half duplex FIFO.
*
****************************************************************************/
@ -715,7 +713,7 @@ int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path,
local_hd_name(path, fullpath);
/* Then open the file for read-only access */
/* Then open the file for write-only access */
ret = local_tx_open(conn, fullpath, nonblock);
if (ret == OK)
@ -726,7 +724,7 @@ int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path,
if (ret == 0)
{
/* Set POLLIN threshold bigger than preamble len.
* This is to avoid non-blocking read failed with -EAGAIN when
* This is to avoid non-blocking write failed with -EAGAIN when
* only preamble len is sent and read by reader.
*/
@ -764,5 +762,3 @@ int local_set_nonblocking(FAR struct local_conn_s *conn)
return ret;
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View file

@ -23,7 +23,6 @@
****************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL_STREAM)
#include <assert.h>
#include <errno.h>
@ -66,7 +65,7 @@
int local_listen(FAR struct socket *psock, int backlog)
{
FAR struct local_conn_s *server;
FAR struct local_conn_s *server = psock->s_conn;
/* Verify that the sockfd corresponds to a connected SOCK_STREAM in this
* address family.
@ -81,8 +80,6 @@ int local_listen(FAR struct socket *psock, int backlog)
net_lock();
server = psock->s_conn;
/* Some sanity checks */
if (server->lc_proto != SOCK_STREAM ||
@ -119,5 +116,3 @@ int local_listen(FAR struct socket *psock, int backlog)
return OK;
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL_STREAM */

View file

@ -47,7 +47,6 @@ static int local_event_pollsetup(FAR struct local_conn_s *conn,
bool setup)
{
pollevent_t eventset;
int ret = OK;
int i;
if (setup)
@ -108,7 +107,7 @@ static int local_event_pollsetup(FAR struct local_conn_s *conn,
nxmutex_unlock(&conn->lc_polllock);
}
return ret;
return OK;
}
/****************************************************************************
@ -121,7 +120,6 @@ static void local_inout_poll_cb(FAR struct pollfd *fds)
poll_notify(&originfds, 1, fds->revents);
}
#endif
/****************************************************************************
@ -160,14 +158,12 @@ void local_event_pollnotify(FAR struct local_conn_s *conn,
int local_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
{
FAR struct local_conn_s *conn;
int ret = -ENOSYS;
conn = psock->s_conn;
FAR struct local_conn_s *conn = psock->s_conn;
int ret = OK;
if (conn->lc_proto == SOCK_DGRAM)
{
return ret;
return -ENOSYS;
}
#ifdef CONFIG_NET_LOCAL_STREAM
@ -280,7 +276,6 @@ int local_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
break;
default:
ret = OK;
break;
}
#endif
@ -312,11 +307,9 @@ pollerr:
int local_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds)
{
FAR struct local_conn_s *conn;
FAR struct local_conn_s *conn = psock->s_conn;
int ret = OK;
conn = psock->s_conn;
if (conn->lc_proto == SOCK_DGRAM)
{
return -ENOSYS;

View file

@ -23,7 +23,6 @@
****************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
#include <sys/param.h>
#include <sys/types.h>
@ -374,7 +373,6 @@ psock_dgram_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
if (conn->pktlen <= 0)
{
ret = local_sync(&conn->lc_infile);
if (ret < 0)
{
nerr("ERROR: Failed to get packet length: %d\n", ret);
@ -473,7 +471,7 @@ errout_with_halfduplex:
return ret < 0 ? ret : readlen;
}
#endif /* CONFIG_NET_LOCAL_STREAM */
#endif /* CONFIG_NET_LOCAL_DGRAM */
/****************************************************************************
* Public Functions
@ -549,5 +547,3 @@ ssize_t local_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
return len;
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View file

@ -36,8 +36,6 @@
#include "local/local.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
/****************************************************************************
* Public Functions
****************************************************************************/
@ -190,8 +188,8 @@ int local_getaddr(FAR struct local_conn_s *conn, FAR struct sockaddr *addr,
if (totlen > *addrlen)
{
pathlen -= (totlen - *addrlen);
totlen = *addrlen;
pathlen -= (totlen - *addrlen);
totlen = *addrlen;
}
/* Copy the Unix domain address */
@ -206,5 +204,3 @@ int local_getaddr(FAR struct local_conn_s *conn, FAR struct sockaddr *addr,
*addrlen = totlen;
return OK;
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View file

@ -23,7 +23,6 @@
****************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
#include <errno.h>
#include <assert.h>
@ -78,7 +77,7 @@ int local_release(FAR struct local_conn_s *conn)
/* Are there still clients waiting for a connection to the server? */
for (waiter = dq_peek(&conn->u.server.lc_waiters);
waiter;
waiter != NULL;
waiter = dq_next(&accept->u.accept.lc_waiter))
{
accept = container_of(waiter, struct local_conn_s,
@ -100,5 +99,3 @@ int local_release(FAR struct local_conn_s *conn)
net_unlock();
return OK;
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View file

@ -23,7 +23,6 @@
****************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
#include <sys/types.h>
#include <sys/socket.h>
@ -178,18 +177,17 @@ static ssize_t local_send(FAR struct socket *psock,
case SOCK_DGRAM:
#endif /* CONFIG_NET_LOCAL_DGRAM */
{
FAR struct local_conn_s *peer;
FAR struct local_conn_s *conn = psock->s_conn;
/* Local TCP packet send */
DEBUGASSERT(buf);
peer = psock->s_conn;
/* Verify that this is a connected peer socket and that it has
* opened the outgoing FIFO for write-only access.
*/
if (peer->lc_state != LOCAL_STATE_CONNECTED)
if (conn->lc_state != LOCAL_STATE_CONNECTED)
{
nerr("ERROR: not connected\n");
return -ENOTCONN;
@ -197,14 +195,14 @@ static ssize_t local_send(FAR struct socket *psock,
/* Check shutdown state */
if (peer->lc_outfile.f_inode == NULL)
if (conn->lc_outfile.f_inode == NULL)
{
return -EPIPE;
}
/* Send the packet */
ret = nxmutex_lock(&peer->lc_sendlock);
ret = nxmutex_lock(&conn->lc_sendlock);
if (ret < 0)
{
/* May fail because the task was canceled. */
@ -212,9 +210,9 @@ static ssize_t local_send(FAR struct socket *psock,
return ret;
}
ret = local_send_packet(&peer->lc_outfile, buf, len,
ret = local_send_packet(&conn->lc_outfile, buf, len,
psock->s_type == SOCK_DGRAM);
nxmutex_unlock(&peer->lc_sendlock);
nxmutex_unlock(&conn->lc_sendlock);
}
break;
default:
@ -433,5 +431,3 @@ ssize_t local_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg,
return len;
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View file

@ -36,8 +36,6 @@
#include "local/local.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL)
/****************************************************************************
* Private Functions
****************************************************************************/
@ -164,5 +162,3 @@ int local_send_packet(FAR struct file *filep, FAR const struct iovec *buf,
return len16 > 0 ? len16 : ret;
}
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View file

@ -41,8 +41,6 @@
#include "local/local.h"
#ifdef CONFIG_NET_LOCAL
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
@ -126,7 +124,6 @@ const struct sock_intf_s g_local_sockif =
*
****************************************************************************/
#if defined(CONFIG_NET_LOCAL_STREAM) || defined(CONFIG_NET_LOCAL_DGRAM)
static int local_sockif_alloc(FAR struct socket *psock)
{
/* Allocate the local connection structure */
@ -144,7 +141,6 @@ static int local_sockif_alloc(FAR struct socket *psock)
psock->s_conn = conn;
return OK;
}
#endif
/****************************************************************************
* Name: local_setup
@ -200,7 +196,6 @@ static int local_setup(FAR struct socket *psock)
return local_sockif_alloc(psock);
#endif /* CONFIG_NET_LOCAL_DGRAM */
#if defined(CONFIG_NET_LOCAL_STREAM) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_CTRL:
if (psock->s_proto == 0 || psock->s_proto == IPPROTO_TCP ||
psock->s_proto == IPPROTO_UDP)
@ -211,7 +206,6 @@ static int local_setup(FAR struct socket *psock)
}
return -EPROTONOSUPPORT;
#endif
default:
return -EPROTONOSUPPORT;
@ -286,7 +280,7 @@ static int local_bind(FAR struct socket *psock,
/* Verify that a valid address has been provided */
if (addr->sa_family != AF_LOCAL || addrlen < sizeof(sa_family_t))
if (addrlen < sizeof(sa_family_t) || addr->sa_family != AF_LOCAL)
{
nerr("ERROR: Invalid address length: %d < %zu\n",
addrlen, sizeof(sa_family_t));
@ -299,7 +293,6 @@ static int local_bind(FAR struct socket *psock,
{
/* Bind a local TCP/IP stream or datagram socket */
#if defined(CONFIG_NET_LOCAL_STREAM) || defined(CONFIG_NET_LOCAL_DGRAM)
#ifdef CONFIG_NET_LOCAL_STREAM
case SOCK_STREAM:
#endif
@ -313,7 +306,6 @@ static int local_bind(FAR struct socket *psock,
ret = psock_local_bind(psock, addr, addrlen);
}
break;
#endif /* CONFIG_NET_LOCAL_STREAM || CONFIG_NET_LOCAL_DGRAM */
default:
ret = -EBADF;
@ -356,7 +348,7 @@ static int local_getsockname(FAR struct socket *psock,
FAR socklen_t *addrlen)
{
FAR struct sockaddr_un *unaddr = (FAR struct sockaddr_un *)addr;
FAR struct local_conn_s *conn;
FAR struct local_conn_s *conn = psock->s_conn;
if (*addrlen < sizeof(sa_family_t))
{
@ -366,8 +358,6 @@ static int local_getsockname(FAR struct socket *psock,
return OK;
}
conn = psock->s_conn;
/* Save the address family */
unaddr->sun_family = AF_LOCAL;
@ -377,11 +367,11 @@ static int local_getsockname(FAR struct socket *psock,
if (conn->lc_type == LOCAL_TYPE_UNNAMED)
{
/* Zero-length sun_path... This is an abstract Unix domain socket */
/* Zero-length sun_path... */
*addrlen = sizeof(sa_family_t);
}
else /* conn->lc_type = LOCAL_TYPE_PATHNAME */
else
{
/* Get the full length of the socket name (incl. null terminator) */
@ -451,8 +441,8 @@ static int local_getpeername(FAR struct socket *psock,
FAR socklen_t *addrlen)
{
FAR struct sockaddr_un *unaddr = (FAR struct sockaddr_un *)addr;
FAR struct local_conn_s *conn;
FAR struct local_conn_s *peer;
FAR struct local_conn_s *conn = psock->s_conn;
FAR struct local_conn_s *peer = conn->lc_peer;
if (*addrlen < sizeof(sa_family_t))
{
@ -464,15 +454,11 @@ static int local_getpeername(FAR struct socket *psock,
/* Verify that the socket has been connected */
conn = psock->s_conn;
if (conn->lc_state != LOCAL_STATE_CONNECTED)
{
return -ENOTCONN;
}
peer = conn->lc_peer;
/* Save the address family */
unaddr->sun_family = AF_LOCAL;
@ -482,11 +468,11 @@ static int local_getpeername(FAR struct socket *psock,
if (peer->lc_type == LOCAL_TYPE_UNNAMED)
{
/* Zero-length sun_path... This is an abstract Unix domain socket */
/* Zero-length sun_path... */
*addrlen = sizeof(sa_family_t);
}
else /* conn->lc_type = LOCAL_TYPE_PATHNAME */
else
{
/* Get the full length of the socket name (incl. null terminator) */
@ -509,13 +495,11 @@ static int local_getpeername(FAR struct socket *psock,
if (peer->lc_type == LOCAL_TYPE_ABSTRACT)
{
unaddr->sun_path[0] = '\0';
strlcpy(&unaddr->sun_path[1],
peer->lc_path, namelen - 1);
strlcpy(&unaddr->sun_path[1], peer->lc_path, namelen - 1);
}
else
{
strlcpy(unaddr->sun_path,
peer->lc_path, namelen);
strlcpy(unaddr->sun_path, peer->lc_path, namelen);
}
*addrlen = sizeof(sa_family_t) + namelen;
@ -693,20 +677,16 @@ static int local_connect(FAR struct socket *psock,
{
/* Perform the datagram connection logic */
/* #warning Missing logic */
return -ENOSYS;
}
break;
#endif /* CONFIG_NET_LOCAL_DGRAM */
#if defined(CONFIG_NET_LOCAL_STREAM) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_CTRL:
{
return -ENOSYS;
}
break;
#endif
default:
return -EBADF;
@ -772,7 +752,6 @@ static int local_close(FAR struct socket *psock)
switch (psock->s_type)
{
#if defined(CONFIG_NET_LOCAL_STREAM) || defined(CONFIG_NET_LOCAL_DGRAM)
#ifdef CONFIG_NET_LOCAL_STREAM
case SOCK_STREAM:
#endif
@ -786,10 +765,8 @@ static int local_close(FAR struct socket *psock)
*/
local_subref(psock->s_conn);
return OK;
}
#endif /* CONFIG_NET_LOCAL_STREAM || CONFIG_NET_LOCAL_DGRAM */
default:
return -EBADF;
@ -811,11 +788,9 @@ static int local_close(FAR struct socket *psock)
static int local_ioctl(FAR struct socket *psock, int cmd, unsigned long arg)
{
FAR struct local_conn_s *conn;
FAR struct local_conn_s *conn = psock->s_conn;
int ret = OK;
conn = psock->s_conn;
switch (cmd)
{
case FIONBIO:
@ -972,6 +947,10 @@ static int local_socketpair(FAR struct socket *psocks[2])
for (i = 0; i < 2; i++)
{
ret = local_set_pollthreshold(conns[i], sizeof(uint16_t));
if (ret < 0)
{
goto errout;
}
}
}
#endif
@ -1039,10 +1018,8 @@ static int local_shutdown(FAR struct socket *psock, int how)
case SOCK_DGRAM:
return -EOPNOTSUPP;
#endif
#if defined(CONFIG_NET_LOCAL_STREAM) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_CTRL:
return -EOPNOTSUPP;
#endif
default:
return -EBADF;
}
@ -1051,5 +1028,3 @@ static int local_shutdown(FAR struct socket *psock, int how)
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* CONFIG_NET_LOCAL */