Skip to content

feat(libkernel): accept MSG_WAITALL in recv, recvfrom and recvmsg on a stream socket - #8474

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/recv-msg-waitall
Oct 21, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/recv-msg-waitall

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

What

recv, recvfrom and recvmsg failed every flag but MSG_PEEK and MSG_DONTWAIT with EOPNOTSUPP. FreeBSD 11.4 accepts MSG_WAITALL (0x40) and, on a stream socket, keeps the receive waiting until the buffer is full, the peer closes or an error occurs (soreceive_generic). A stream socket now passes the flag to the host receive (MSG_WAITALL on Winsock and Linux); a datagram socket ignores it, as a record is delivered whole. The Technical debt entry says what is not measured: nonblocking sockets and MSG_WAITALL | MSG_PEEK follow the host, and SO_RCVTIMEO bounds only the wait for the first data.
Fixes #8473
Overlap: #7090 (SCM_RIGHTS, open) also changes recvmsg; git merge-tree of the two heads has two conflicts in Udp.cpp, so whichever lands second rebases. git merge-tree against #8392, #8448, #8463, #7511, #7502, #7485, #7850 and #7490 is clean. pr_overlap was not run.

Tested

Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, on upstream/main 44e3389 + this commit:

  • guest_tcp: the new case aborts without the change to Udp.cpp (recv with 0x40 answers EOPNOTSUPP) and passes with it. It checks a 4+4 byte request split by 150 ms, a short result when the peer closes after 2 bytes (recvfrom), and a datagram socket that ignores the flag.
  • guest_sce_net, guest_socket_error, guest_socket_options, guest_socket_timeouts, guest_udp, guest_poll, guest_socket_pair and guest_recvmsg_memory pass.
  • python tools/check_conventions.py --base upstream/main: passes.
  • Not tested: Linux/macOS, a console, a title run, recvmsg with MSG_WAITALL (same flag path as recvfrom, no dedicated case), a nonblocking socket.

Checklist

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…a stream socket

soreceive_generic keeps a MSG_WAITALL receive on a stream socket waiting until
the buffer is full, the peer closes or an error occurs. The three calls failed
every flag but MSG_PEEK and MSG_DONTWAIT with EOPNOTSUPP. A stream socket now
passes the flag to the host receive; a datagram socket ignores it, as a record
is delivered whole.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 7090 core/libs/prx/libkernel/Socket/src/Udp.cpp L1520-1521
docs/dev/debt/libkernel.md L190

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4630 docs/dev/debt/libkernel.md
PR 5021 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestTcp.cpp
PR 6149 docs/dev/debt/libkernel.md
PR 6469 docs/dev/debt/libkernel.md
PR 6740 docs/dev/debt/libkernel.md
PR 6879 docs/dev/debt/libkernel.md
PR 6936 docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 docs/dev/debt/libkernel.md
PR 7201 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 7447 docs/dev/debt/libkernel.md
PR 7509 docs/dev/debt/libkernel.md
PR 7653 docs/dev/debt/libkernel.md
PR 8520 docs/dev/debt/libkernel.md
PR 8547 docs/dev/debt/libkernel.md
PR 8726 docs/dev/debt/libkernel.md
PR 9099 docs/dev/debt/libkernel.md
PR 9137 docs/dev/debt/libkernel.md

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the flag path against FreeBSD 11.4 soreceive_generic (stream passes MSG_WAITALL to the host, datagram ignores it), all three call sites on current main, the new guest_tcp case (fails with EOPNOTSUPP without the change) and the debt entry; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs fix error Closes an issue (Fixes #N) libkernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libkernel: recv, recvfrom and recvmsg fail MSG_WAITALL with EOPNOTSUPP where FreeBSD 11.4 waits for the whole request

2 participants