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 a8bb78586401534e0d5f64777445f3d18c10f8ad Author: Marco Casaroli <[email protected]> AuthorDate: Thu Nov 26 08:51:17 2026 +0100 Documentation/reference/user: Describe SO_RCVTIMEO and addrlen of accept(). accept() waits at most for the receive timeout of the listener (SO_RCVTIMEO) and then returns EAGAIN. An address longer than the buffer of the caller is truncated, and addrlen gives its whole length. An addr without addrlen gives EFAULT. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- Documentation/reference/user/11_network.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/reference/user/11_network.rst b/Documentation/reference/user/11_network.rst index 594760ca7a0..94cdf727d99 100644 --- a/Documentation/reference/user/11_network.rst +++ b/Documentation/reference/user/11_network.rst @@ -211,11 +211,13 @@ the following paragraphs. On return, the ``addr`` structure is filled in with the address of the connecting entity. The ``addrlen`` argument initially contains the size of the structure pointed to by ``addr``; on return it will contain the - actual length of the address returned. + actual length of the address. If the address is longer than the + buffer, it is truncated to the size of the buffer. If no pending connections are present on the queue, and the socket is not marked as non-blocking, accept blocks the caller until a connection - is present. If the socket is marked non-blocking and no pending + is present, or until the receive timeout of the socket (``SO_RCVTIMEO``) + expires. If the socket is marked non-blocking and no pending connections are present on the queue, accept returns ``EAGAIN``. **Input Parameters:** @@ -229,7 +231,8 @@ the following paragraphs. non-negative integer that is a descriptor for the accepted socket. - ``EAGAIN`` or ``EWOULDBLOCK``: The socket is marked non-blocking and - no connections are present to be accepted. + no connections are present to be accepted, or the receive timeout + (``SO_RCVTIMEO``) expired. - ``EBADF``: The descriptor is invalid. - ``ENOTSOCK``: The descriptor references a file, not a socket. - ``EOPNOTSUPP``: The referenced socket is not of type ``SOCK_STREAM``. @@ -241,7 +244,7 @@ the following paragraphs. reached. - ``ENFILE``: The system maximum for file descriptors has been reached. - ``EFAULT``: The addr parameter is not in a writable part of the user - address space. + address space, or ``addr`` is given without ``addrlen``. - ``ENOBUFS`` or ``ENOMEM``: Not enough free memory. - ``EPROTO``: Protocol error. - ``EPERM``: Firewall rules forbid connection.
