xiaoxiang781216 commented on a change in pull request #4593:
URL: https://github.com/apache/incubator-nuttx/pull/4593#discussion_r713841508
##########
File path: net/local/local_sendpacket.c
##########
@@ -102,6 +103,114 @@ static int local_fifo_write(FAR struct file *filep, FAR
const uint8_t *buf,
return nwritten > 0 ? nwritten : ret;
}
+/****************************************************************************
+ * Name: local_sendctl
+ *
+ * Description:
+ * Handle the socket message conntrol field
+ *
+ * Input Parameters:
+ * conn Local connection instance
+ * msg Message to send
+ *
+ * Returned Value:
+ * On any failure, a negated errno value is returned
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_NET_LOCAL_SCM
+static int local_sendctl(FAR struct local_conn_s *conn,
Review comment:
call local_sendctl in local_sendmsg, so we don't need modify
local_sendctl prototype
##########
File path: net/local/local_recvmsg.c
##########
@@ -375,30 +511,48 @@ psock_dgram_recvmsg(FAR struct socket *psock, FAR struct
msghdr *msg,
ssize_t local_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
int flags)
{
+ ssize_t readlen;
+
DEBUGASSERT(psock && psock->s_conn && msg);
/* Check for a stream socket */
#ifdef CONFIG_NET_LOCAL_STREAM
if (psock->s_type == SOCK_STREAM)
{
- return psock_stream_recvmsg(psock, msg, flags);
+ readlen = psock_stream_recvmsg(psock, msg, flags);
}
else
#endif
#ifdef CONFIG_NET_LOCAL_DGRAM
if (psock->s_type == SOCK_DGRAM)
{
- return psock_dgram_recvmsg(psock, msg, flags);
+ readlen = psock_dgram_recvmsg(psock, msg, flags);
}
else
#endif
{
DEBUGPANIC();
nerr("ERROR: Unrecognized socket type: %" PRIu8 "\n", psock->s_type);
- return -EINVAL;
+ readlen = -EINVAL;
}
+
+#ifdef CONFIG_NET_LOCAL_SCM
+ /* Receive the control message */
+
+ if (readlen >= 0 && msg->msg_control &&
+ msg->msg_controllen > sizeof(struct cmsghdr))
+ {
+ int ret = local_recvctl(psock->s_conn, msg);
+ if (ret < 0)
Review comment:
since local_recvctl is called inside local_recvmsg, we don't need modify
psock_dgram_recvmsg/psock_stream_recvmsg naming and prototype
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]