Skip to content

Added sock_recv_msg, sock_send_msg - #118

Draft
sadhbh-c0d3 wants to merge 4 commits into
wasix-org:mainfrom
Anodized-Titanium:socket-send-recv-msg
Draft

Added sock_recv_msg, sock_send_msg#118
sadhbh-c0d3 wants to merge 4 commits into
wasix-org:mainfrom
Anodized-Titanium:socket-send-recv-msg

Conversation

@sadhbh-c0d3

@sadhbh-c0d3 sadhbh-c0d3 commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Adds POSIX sendmsg() and recvmsg() support on top of the new WASIX sock_send_msg / sock_recv_msg ABI.

The libc wrappers translate between POSIX struct msghdr and the WASIX ABI shape:

  • msg_iov maps to WASIX iovecs,
  • optional msg_name maps to __wasi_addr_port_t,
  • optional msg_control maps to a raw WASIX control-message buffer,
  • returned WASIX control data is converted back into POSIX cmsghdr layout.

The control-message translation currently recognizes SOL_SOCKET + SCM_RIGHTS and represents it using the new WASIX control-message header/type definitions.

Motivation

libuv and Node-style runtimes expect normal POSIX sendmsg() / recvmsg() behavior for IPC and socketpair paths. In particular, libuv uses these APIs for handle-passing paths such as cluster/process IPC.

Before this change, WASIX libc did not expose a proper POSIX-compatible route for these calls. That forced higher layers to carry WASIX-specific workarounds or avoid normal libuv code paths.

Behavior

Payload-only sendmsg() / recvmsg() now route through WASIX socket message syscalls.

For ancillary data:

  • outgoing POSIX control messages are packed into the WASIX control-message format;
  • incoming WASIX control messages are unpacked into POSIX cmsghdr records;
  • unsupported control-message types return an error instead of being silently ignored.

Actual descriptor passing depends on runtime support in Wasmer. Until that phase is complete, runtimes may still return unsupported for outgoing control data, but libc now has the correct ABI path and translation layer.

@sadhbh-c0d3
sadhbh-c0d3 marked this pull request as draft June 9, 2026 17:07
@sadhbh-c0d3
sadhbh-c0d3 marked this pull request as ready for review June 9, 2026 18:20
@sadhbh-c0d3
sadhbh-c0d3 marked this pull request as draft June 10, 2026 16:29
@Arshia001

Copy link
Copy Markdown

We'll keep this around for when we start implementing the syscalls properly in Wasmer. For now, since there is no full implementation, this PR should remain a draft.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants