Implement recvmmsg and sendmmsg - #27395
Merged
Merged
Conversation
sbc100
reviewed
Jul 21, 2026
sbc100
reviewed
Jul 21, 2026
sbc100
left a comment
Collaborator
There was a problem hiding this comment.
lgtm although I would still expect the stubs for these syscalls to be removed (and also the syscalls themselves the syscalls.h, etc).
Ideally I would love to see the bugfix land first/separately, but its also not a big deal if testing in isolation is too difficult.
Collaborator
Author
|
Sure, I've gone ahead and split out the bugfixes into #27399. |
sbc100
pushed a commit
that referenced
this pull request
Jul 22, 2026
This fixes three issues in the `recvmsg` syscall implementation for sockets, split out separately from #27395 per review feedback. The bugs: * Datagram data was written at the wrong offsets when scattered across multiple iovecs — `HEAPU8.set(buf, iovbase + bytesRead)` skipped ahead by the bytes already read into previous iovecs, corrupting all iovecs after the first. * `msg_namelen` was not updated to reflect the actual source address size. * `msg_controllen` and `msg_flags` were left untouched rather than zeroed, leaving callers reading uninitialized values as control data / flags. Adds `sockets.test_noderawsockets_udp_recvmsg` covering a datagram scattered across two iovecs along with the msghdr output fields, verified failing before the fix.
|
sbc100
approved these changes
Jul 22, 2026
Implements recvmmsg and sendmmsg in musl in terms of recvmsg and sendmsg, removing the now-unreferenced __syscall_recvmmsg and __syscall_sendmmsg stubs and syscall definitions.
sbc100
approved these changes
Jul 22, 2026
sbc100
enabled auto-merge (squash)
July 22, 2026 23:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements
recvmmsgandsendmmsg, which were previouslyENOSYSstubs.Per review feedback, the implementations now live in musl's
sendmmsg.candrecvmmsg.crather than the syscall stubs:sendmmsg.calready contained the emulation loop (previously gated behindLONG_MAX > INT_MAX), which is now also enabled under__EMSCRIPTEN__, andrecvmmsg.cgains an equivalentrecvmsgloop supportingMSG_WAITFORONE(timeouts reportENOSYS).Since nothing references the syscalls anymore, the
__syscall_recvmmsg/__syscall_sendmmsgsurface is removed entirely: theUNIMPLEMENTEDstubs, theSYS_mappings inarch/emscripten/bits/syscall.h, the declarations inemscripten/syscalls.h, and theirnative_sigs.pyentries.The
recvmsgmsghdr output fixes previously bundled here were split out into #27399.Adds
sockets.test_noderawsockets_mmsgbatching two datagrams out viasendmmsgand receiving them back in a singlerecvmmsgcall.Made with AI assistance under my review