Skip to content

vms-706: build vms_stdio.c + vms_futex.c on VAX (close the freestanding-facility gap) - #798

Merged
baron-3dl merged 3 commits into
mainfrom
work/vms-706-vax-freestanding
Aug 28, 2026
Merged

baron-3dl merged 3 commits into
mainfrom
work/vms-706-vax-freestanding

Conversation

@baron-3dl

Copy link
Copy Markdown
Contributor

The gap (CONVERGE #3)

The freestanding buffered-I/O (vms_stdio.c) and futex (vms_futex.c) facilities built on x86_64/aarch64/alpha but were absent on VAX: the NetBSD syscall header omitted vms_sys_openat/vms_sys_futex, vms_types.h left VMS_FUTEX_* undefined on NetBSD, and both files were excluded from the netbsd build set — any feature resting on them was silently VAX-absent. Converged by providing the wrappers (max-shared-code directive), not fencing the feature off VAX.

Changes (3 files)

  • arch/vax/vms_syscall_netbsd.h — add vms_sys_openat (NetBSD libc openat(2); flags is the VMS_O_* mask) and vms_sys_futex. NetBSD ships no libc futex() — the syscall is __futex (SYS___futex), a 7-arg form that inserts val2 before val3 (unused by our WAIT/WAKE/WAIT_BITSET ops → 0); called via syscall(SYS___futex, …). The wrapper folds errno into a raw negative-errno return so vms_futex.c's vms_condvar_timedwait — which tests ret == -VMS_ETIMEDOUT — keeps working (the libc -1/errno convention would break timeout detection).
  • vms_types.h — add a __NetBSD__ branch defining VMS_FUTEX_* as aliases of <sys/futex.h> FUTEX_* (substrate-correct, _Static_assert-checked — never a transcribed Linux number, exactly what the prior "Linux-only" note guarded against). VMS_O_* was already NetBSD-mapped.
  • CMakeLists.txt — add both files to the netbsd VMSSYS_C_SOURCES.

Safety + proof

  • The Linux/host path is untouched (both additions are __NetBSD__-guarded) — host tests unaffected.
  • Both TUs cross-compile clean to elf32-vax against the pinned NetBSD 10.1 sysroot (-Wall -Wextra, static-asserts pass, U openat / U syscall referenced). The vax-cmake-images CI gate now compiles them.
  • Runtime SIMH verification of the futex wrapper deferred (host RAM-blocked); the __futex 7-arg ABI is verified against NetBSD syscalls.master.

Shared-core convergence — rides the 3-way width gate.

🤖 Generated with Claude Code

baron-3dl and others added 3 commits August 27, 2026 20:21
…ng-facility gap)

The freestanding buffered-I/O (vms_stdio.c) and futex (vms_futex.c) facilities
built on x86_64/aarch64/alpha but were ABSENT on VAX: the NetBSD syscall header
omitted vms_sys_openat/vms_sys_futex and vms_types.h left VMS_FUTEX_* undefined
on NetBSD, so both files were excluded from the netbsd build set -- any feature
resting on them was silently VAX-absent. Converged (per the max-shared-code
directive) by providing the wrappers, NOT fencing the feature off.

  * arch/vax/vms_syscall_netbsd.h: add vms_sys_openat (NetBSD libc openat(2);
    flags is the VMS_O_* mask) and vms_sys_futex. NetBSD ships no libc futex()
    wrapper -- the syscall is __futex (SYS___futex), a 7-arg form that inserts
    `val2` before val3 (unused by our WAIT/WAKE/WAIT_BITSET ops -> 0); called
    via syscall(SYS___futex, ...). The wrapper folds errno into a raw
    negative-errno return so vms_futex.c's vms_condvar_timedwait, which tests
    `ret == -VMS_ETIMEDOUT`, keeps working (the libc -1/errno convention would
    break timeout detection).
  * vms_types.h: add a __NetBSD__ branch defining VMS_FUTEX_* as aliases of
    <sys/futex.h> FUTEX_* (substrate-correct, _Static_assert-checked -- never a
    transcribed Linux number, which is exactly what the prior "Linux-only" note
    guarded against). VMS_O_* was already NetBSD-mapped.
  * CMakeLists.txt: add vms_stdio.c + vms_futex.c to the netbsd VMSSYS_C_SOURCES.

The Linux/host path is untouched (both additions are __NetBSD__-guarded), so
host tests are unaffected. Proven: both TUs cross-compile clean to elf32-vax
against the pinned NetBSD 10.1 sysroot (-Wall -Wextra, static-asserts pass,
U openat / U syscall referenced) -- the vax-cmake-images CI gate now compiles
them. Runtime SIMH verification of the futex wrapper deferred (host RAM-blocked);
the __futex 7-arg ABI is verified against NetBSD syscalls.master.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@baron-3dl
baron-3dl merged commit cfcb54e into main Aug 28, 2026
96 checks passed
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.

1 participant