casaroli commented on code in PR #21324:
URL: https://github.com/apache/nuttx/pull/21324#discussion_r4436002178


##########
fs/socket/socket.c:
##########
@@ -129,7 +129,11 @@ static ssize_t sock_file_read(FAR struct file *filep, FAR 
char *buffer,
 static ssize_t sock_file_write(FAR struct file *filep,
                                FAR const char *buffer, size_t buflen)
 {
-  return psock_send(filep->f_priv, buffer, buflen, 0);
+  ssize_t ret;
+
+  ret = psock_send(filep->f_priv, buffer, buflen, 0);

Review Comment:
   psock_send() does not raise SIGPIPE: kernel code also sends with it (nfs, 
v9fs, userfs, telnet, vnc, usrsock), and that code must not get the signal. So 
the signal is raised in the user entry points only: send(), sendto(), 
sendmsg(), and write() on a socket, which comes here.
   



##########
include/nuttx/net/net.h:
##########
@@ -880,6 +880,24 @@ int psock_connect(FAR struct socket *psock, FAR const 
struct sockaddr *addr,
 ssize_t psock_sendmsg(FAR struct socket *psock, FAR const struct msghdr *msg,
                       int flags);
 
+/****************************************************************************
+ * Name: psock_sigpipe
+ *
+ * Description:
+ *   Raise SIGPIPE in the calling thread when a send on a stream socket
+ *   failed with -EPIPE, unless 'flags' has MSG_NOSIGNAL.  The user
+ *   interfaces (send(), sendto(), sendmsg() and write() on a socket) call
+ *   it.  The psock_send*() interfaces do not raise SIGPIPE.
+ *
+ * Input Parameters:
+ *   psock    The socket of the send
+ *   ret      The result of the send
+ *   flags    The send flags
+ *
+ ****************************************************************************/
+
+void psock_sigpipe(FAR struct socket *psock, ssize_t ret, int flags);

Review Comment:
   fs/socket/socket.c (write() on a socket) calls it too, and fs/ cannot 
include net/socket/socket.h: fs/Makefile adds only fs/ and sched/ to the 
include path.
   



-- 
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]

Reply via email to