wavefnd / wavefnd/Wave

Replace libc wrappers in Linux event and vectored I/O providers with direct syscalls

Open
#515 0 comments 0 reactions 0 assignees View on GitHub
cross-platform enhancement help wanted needs testing
Dominant language
Rust
Stars
53
Forks
16
Avg merge
4h 22m
Merged PRs (30d)
46

Description

## Confirmed implementation gap

The Linux syscall layer is intended to support these operations directly, but two current modules still call libc wrappers:

- `std/sys/linux/event.wave`: `epoll_create1`, `epoll_ctl`, `epoll_wait`, `__errno_location`.
- `std/sys/linux/vector_io.wave`: `sendmsg`, `recvmsg`, `__errno_location`.

Building this source with `wavec build repro.wave --emit=obj --out-dir out`, then running `nm -u out/repro.o`, confirms those unresolved libc symbols:

```wave
import("std::sys::event")::{event_create, event_close};
import("std::sys::vector_io")::{vector_recv};
fun main() -> i32 {
var handle: i64 = event_create(1);
if (handle >= 0) { event_close(handle); }
return vector_recv(-1, null, 0, 0) as i32;
}
```

This is an implementation follow-up, not a claim that the existing hosted tests fail. #502 converted the corresponding FreeBSD operations to direct syscalls; Linux retains these older wrapper dependencies.

## Scope and acceptance

- [ ] Route epoll and sendmsg/recvmsg through the existing Linux architecture syscall providers on amd64, arm64, riscv64 and loong64.
- [ ] Verify syscall numbers and native structure layouts per architecture; preserve packed amd64 epoll events and the aligned layouts on the other targets.
- [ ] Preserve negative errno results directly without `__errno_location`.
- [ ] Add object/IR checks showing the listed libc wrapper dependencies are absent.
- [ ] Add observable event and scatter/gather success, error, partial-I/O and peer-shutdown tests, including libc-independent QEMU executables where available.
- [ ] Keep public std::net behavior intact and retain native Win32/Winsock FFI on Windows.

Do not replace the wrappers with a new libc binding dependency. Resolver/interface-provider redesign and async/IOCP integration in #445 are separate work. This requires syscall/ABI validation and is not a good first issue.

Audited on canonical master `0c67f4cc0c3946cbf708c11ef79db927ec8f054e` (same source tree as #502 head). Executable reproductions used Fedora Linux amd64, Wave `0.2.1-pre-beta-dev`, LLVM 21.1.8.

Contributor guide

Open the contributing guide

Research direction

Start with std/sys/linux/event.wave and std/sys/linux/vector_io.wave, then compare the existing Linux architecture syscall providers and the direct FreeBSD work from #502. Reproduce the unresolved symbols with wavec build ... --emit=obj and nm -u, then use the issue’s architecture, object/IR, event, and scatter/gather checks to verify the wrapper dependencies are absent and behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
networking, operating-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.