This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 85d97d5f20785bc1e073fbaa6a01a1aceace13a8
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Nov 26 08:51:06 2026 +0100

    Documentation: Describe EALREADY and EINTR of TCP connect().
    
    connect() returns EALREADY while an earlier connect() is in progress,
    also after a signal (EINTR) or the send timeout ended its wait, and
    EISCONN for a listening socket.  A RST after the FIN of the peer gives
    EPIPE (CLOSE_WAIT) or ECONNRESET (LAST_ACK) in SO_ERROR.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 Documentation/os/networking/tcp_state_machine.rst | 4 +++-
 Documentation/reference/user/11_network.rst       | 8 +++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/os/networking/tcp_state_machine.rst 
b/Documentation/os/networking/tcp_state_machine.rst
index 049177ee8af..d48d8d1ca6a 100644
--- a/Documentation/os/networking/tcp_state_machine.rst
+++ b/Documentation/os/networking/tcp_state_machine.rst
@@ -363,7 +363,9 @@ gives end-of-file and a send gives ``EPIPE`` (and 
``SIGPIPE`` without
 ``MSG_NOSIGNAL``).  ``poll()`` gives ``POLLHUP`` and ``POLLIN``, and
 ``POLLERR`` while the ``ECONNRESET`` is not yet reported.  After the FIN of
 the peer the application already read the end of the stream: a RST does not
-change what a receive (end-of-file) or a send (``EPIPE``) gives.
+change what a receive (end-of-file) or a send (``EPIPE``) gives, and
+``getsockopt(SO_ERROR)`` gives ``EPIPE`` (in ``TCP_CLOSE_WAIT``) or
+``ECONNRESET`` (in ``TCP_LAST_ACK``) once, as Linux.
 
 Close or reset before accept() or connect() returns
 ---------------------------------------------------
diff --git a/Documentation/reference/user/11_network.rst 
b/Documentation/reference/user/11_network.rst
index e286f2faf2f..594760ca7a0 100644
--- a/Documentation/reference/user/11_network.rst
+++ b/Documentation/reference/user/11_network.rst
@@ -135,8 +135,9 @@ the following paragraphs.
   ``EAGAIN`` No more free local ports or insufficient entries in the
   routing cache. For PF_INET.
 
-  ``EALREADY`` The socket is non-blocking and a previous connection
-  attempt has not yet been completed.
+  ``EALREADY`` A previous connection attempt has not yet been completed:
+  the socket is non-blocking, or a signal or the send timeout ended the
+  wait of the earlier ``connect()``.
 
   ``EBADF`` The file descriptor is not a valid index in the descriptor
   table.
@@ -155,8 +156,9 @@ the following paragraphs.
   reports ``POLLOUT`` when it completes.
 
   ``EINTR`` The system call was interrupted by a signal that was caught.
+  The connection goes on: ``poll()`` reports ``POLLOUT`` when it completes.
 
-  ``EISCONN`` The socket is already connected.
+  ``EISCONN`` The socket is already connected, or it listens.
 
   ``ENETUNREACH`` Network is unreachable.
 

Reply via email to