vms-706: build vms_stdio.c + vms_futex.c on VAX (close the freestanding-facility gap) - #798
Merged
Merged
Conversation
…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>
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.
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 omittedvms_sys_openat/vms_sys_futex,vms_types.hleftVMS_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— addvms_sys_openat(NetBSD libcopenat(2);flagsis theVMS_O_*mask) andvms_sys_futex. NetBSD ships no libcfutex()— the syscall is__futex(SYS___futex), a 7-arg form that insertsval2beforeval3(unused by our WAIT/WAKE/WAIT_BITSET ops → 0); called viasyscall(SYS___futex, …). The wrapper folds errno into a raw negative-errno return sovms_futex.c'svms_condvar_timedwait— which testsret == -VMS_ETIMEDOUT— keeps working (the libc-1/errno convention would break timeout detection).vms_types.h— add a__NetBSD__branch definingVMS_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 netbsdVMSSYS_C_SOURCES.Safety + proof
__NetBSD__-guarded) — host tests unaffected.-Wall -Wextra, static-asserts pass,U openat/U syscallreferenced). Thevax-cmake-imagesCI gate now compiles them.__futex7-arg ABI is verified against NetBSDsyscalls.master.Shared-core convergence — rides the 3-way width gate.
🤖 Generated with Claude Code