ntsync: runtime kernel/userspace backend detection - #38
Merged
Conversation
…-time #ifdef Replace the hardcoded __ANDROID__ userspace-ntsync selection with runtime detection: wineserver opens /dev/ntsync and probes it with a real NTSYNC_IOC_CREATE_EVENT ioctl (catches SELinux/seccomp-blocked nodes); if the device is missing or unusable it falls back to the userspace libntsync_android shm backend. PROTON_NO_NTSYNC=1 still disables both. - add android/ntsync_android/ntsync_kernel_abi.h: frozen kernel uapi ioctl numbers, pairs with ntsync_user.h (whose structs clash with ntsync_tmp.h, so both cannot be included together) - server/inproc_sync.c: runtime get_inproc_device_fd() with kernel probe + userspace fallback; all call sites dispatch on ntsync_userspace - dlls/ntdll/unix/sync.c: compile both linux_* and userspace_* paths, dispatch per call; client learns backend via init_first_thread reply - server/thread.c, process.c, ntdll/unix/server.c, unix_private.h: matching runtime branches; ntsync_sweep_dead gated on userspace active (no shm region auto-init in kernel mode) - README: document runtime backend selection order Verified: full 56-patch train applies on pristine HEAD; Android arm64ec builds of server/wineserver and dlls/ntdll/ntdll.so link with zero new warnings; non-Android path passes -fsyntax-only -Werror.
Release notes now describe runtime backend selection (kernel /dev/ntsync probe at wineserver startup, userspace ntsync-android fallback, PROTON_NO_NTSYNC=1 to disable) instead of the old compile-time userspace selection. ntsync-android library pinned unchanged at 7ce6435; the accumulated changelog is replaced with just this build's changes. App-facing descriptions updated to match.
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.
Summary
Replaces the compile-time
#ifdef __ANDROID__all-or-nothing userspace-ntsync selection with runtime backend detection:/dev/ntsyncand probes it with a realNTSYNC_IOC_CREATE_EVENTioctl at startup (catches SELinux/seccomp-blocked nodes that are openable but unusable)PROTON_NO_NTSYNC=1still disables both backendsinit_first_threadreply (NTSYNC_ANDROID_USED_BY_SERVERsentinel)Changes
android/ntsync_android/ntsync_kernel_abi.h— frozen kernel uapi ioctl numbers, pairs withntsync_user.h(whose structs clash withntsync_tmp.h, so both cannot be included in one TU)server_inproc_sync_c.patch— runtimeget_inproc_device_fd()with kernel probe + userspace fallback; all call sites dispatch on antsync_userspaceflagdlls_ntdll_unix_sync_c.patch— bothlinux_*(ioctl) anduserspace_*(libntsync_android) paths compiled in, per-call dispatchserver_thread_c/server_process_c/dlls_ntdll_unix_server_c/dlls_ntdll_unix_unix_private_hpatches — matching runtime branches;ntsync_sweep_dead()now gated on userspace active (no ~960 KB shm region init on kernel-ntsync devices)android/ntsync_android/README.md— documents runtime backend selection orderbuild-proton.yml— release notes updated; ntsync-android library pinned unchanged at7ce6435No ntsync-android library changes; no build-script changes (same patch filenames).
Verification
proton_11.0-2HEAD (worktree-tested)server/wineserveranddlls/ntdll/ntdll.socompile and link with-lntsync_android— zero new warnings-fsyntax-only -U__ANDROID__ -Werrorpasses on all touched files (non-Android builds compile identical to upstream)Test plan
NTSYNC_DEBUG=1— expect log linentsync: no usable /dev/ntsync, using userspace ntsync.on devices without the kernel driver/dev/ntsync(custom kernel) — expectntsync: up and running.and no shm region created