This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit c3fa5beec26cf313a50983ee038c0543d915057e Author: zhanghongyu <[email protected]> AuthorDate: Fri Oct 16 17:21:51 2026 +0800 net/local: give the default DGRAM rcvsize room for the preamble setsockopt(SO_RCVBUF) adds the maximum preamble to the requested size, so the value asked for is the usable payload; the default did not, leaving only CONFIG_DEV_FIFO_SIZE - 4 - pathlen. A 1008 byte datagram with an 18 byte path needs 1030 of a 1024 byte FIFO. That was hidden while the frame went out in pieces; an atomic frame would now be refused with -EMSGSIZE. Cost is 4 + UNIX_PATH_MAX per DGRAM FIFO. The headroom is applied in local_sockif_alloc(), where lc_proto is already known, so SOCK_STREAM keeps the plain CONFIG_DEV_FIFO_SIZE default and the runtime test matches the one the SO_RCVBUF handlers use. Signed-off-by: zhanghongyu <[email protected]> --- net/local/local_sockif.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/net/local/local_sockif.c b/net/local/local_sockif.c index 5e729603062..4e8f1f40d03 100644 --- a/net/local/local_sockif.c +++ b/net/local/local_sockif.c @@ -149,6 +149,22 @@ static int local_sockif_alloc(FAR struct socket *psock) /* Save the pre-allocated connection in the socket structure */ conn->lc_proto = psock->s_type; + +#ifdef CONFIG_NET_LOCAL_DGRAM + /* Match the SO_RCVBUF accounting below: the configured size is the usable + * payload, so a DGRAM FIFO additionally carries the largest possible + * preamble. Without the headroom a payload of exactly + * CONFIG_DEV_FIFO_SIZE could never be written atomically. + */ + + if (psock->s_type == SOCK_DGRAM) + { + conn->lc_rcvsize = MIN(CONFIG_DEV_FIFO_SIZE + + sizeof(lc_size_t) * 2 + UNIX_PATH_MAX, + CONFIG_DEV_PIPE_MAXSIZE); + } +#endif + psock->s_conn = conn; return OK; }
