Skip to content

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

Open

Description

@LunaStev

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:

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.

Activity

  1. added
    enhancement
    help wanted
    needs testing
    cross-platform
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cross-platformenhancementhelp wantedneeds testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions