From 9fd4d6b7678ba664af50c3ed31d67e20e0259e1d Mon Sep 17 00:00:00 2001 From: Zhe Weng Date: Fri, 24 Mar 2023 17:11:39 +0800 Subject: [PATCH] usrsock_server: Do not poll SOCK_CTRL. It seems that we don't need to poll the SOCK_CTRL sockets, so skip them in usrsock server. Signed-off-by: Zhe Weng --- drivers/usrsock/usrsock_rpmsg_server.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/usrsock/usrsock_rpmsg_server.c b/drivers/usrsock/usrsock_rpmsg_server.c index 85b00fb8d2..421ae37cb4 100644 --- a/drivers/usrsock/usrsock_rpmsg_server.c +++ b/drivers/usrsock/usrsock_rpmsg_server.c @@ -1027,8 +1027,16 @@ static void usrsock_rpmsg_poll_setup(FAR struct pollfd *pfds, pollevent_t events) { FAR struct usrsock_rpmsg_s *priv = (FAR struct usrsock_rpmsg_s *)pfds->arg; + FAR struct socket *psock = &priv->socks[pfds->fd]; int ret = 0; + /* No poll for SOCK_CTRL. */ + + if (psock->s_type == SOCK_CTRL) + { + return; + } + net_lock(); if (events) @@ -1037,7 +1045,7 @@ static void usrsock_rpmsg_poll_setup(FAR struct pollfd *pfds, { pfds->revents = 0; pfds->events = events; - ret = psock_poll(&priv->socks[pfds->fd], pfds, true); + ret = psock_poll(psock, pfds, true); } else { @@ -1047,15 +1055,15 @@ static void usrsock_rpmsg_poll_setup(FAR struct pollfd *pfds, else { pfds->events = 0; - ret = psock_poll(&priv->socks[pfds->fd], pfds, false); + ret = psock_poll(psock, pfds, false); } if (ret < 0) { nerr("psock_poll failed. ret %d domain %u type %u pfds->fd %d" ", pfds->events %08" PRIx32 ", pfds->revents %08" PRIx32, - ret, priv->socks[pfds->fd].s_domain, priv->socks[pfds->fd].s_type, - pfds->fd, pfds->events, pfds->revents); + ret, psock->s_domain, psock->s_type, pfds->fd, + pfds->events, pfds->revents); } net_unlock();