feat(backend): portable process identity for Windows - #51
Closed
loss-and-quick wants to merge 2 commits into
Closed
Conversation
proc.rs was POSIX-only: pid matching read /proc/<pid>/exe dev/ino and termination went through libc::kill. Split the OS-specific half into a cfg-gated `imp` module so the crate builds on Windows too: - POSIX keeps the /proc inode match + SIGTERM/SIGKILL teardown. - Windows matches a pid by its full image path (QueryFullProcessImageNameW) and ends it with TerminateProcess; there is no SIGTERM, but the wintun driver reclaims a core's adapter on process exit, so the hard kill stays clean for a graceful stop. run/silent/spawn_logged/read_pidfile were already portable and stay shared. libc moves under cfg(unix); windows-sys (Win32 Threading + Foundation) comes in under cfg(windows). Shell/proc-dependent unit tests are gated to unix.
The `rust` job runs on Linux and never compiles proc.rs's #[cfg(windows)] path, so its Win32 code would ship unverified. Add a windows-latest job that clippy-checks kasumi-backend (cross-platform crates) on a Windows runner, scoped to crates/ + Cargo changes. Refresh the desktop-linux comment: the backend now builds on Windows; only the full src-tauri desktop bundle stays deferred until the Windows Platform port lands.
Owner
Author
|
Superseded: the work is now one Windows-support PR on |
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
First step of bringing Windows back as a desktop target (it was dropped because the
backend was POSIX-only). This PR makes the neutral backend build on Windows by
porting the one OS-specific piece — process identity in
crates/kasumi-backend/src/proc.rs.proc.rswas POSIX-only: it matched a pid by/proc/<pid>/exedev/ino and terminatedvia
libc::kill. The OS-specific half now lives in acfg-gatedimpmodule:/procinode match + SIGTERM→SIGKILL graceful teardown.QueryFullProcessImageNameW) andends it with
TerminateProcess. There is no SIGTERM, but the wintun driver reclaims acore's tun adapter on process exit, so the hard kill stays clean for a graceful stop.
run/silent/spawn_logged/read_pidfilewere already portable and stay shared.libcmoves undercfg(unix);windows-sys(Win32 Threading + Foundation) comes inunder
cfg(windows).The
rustCI job runs on Linux and never compiles the#[cfg(windows)]path, so a newwindows-checkjob clippy-checks the backend on a Windows runner — otherwise the Win32code would ship unverified. The full src-tauri desktop bundle (tun + routing Platform)
stays Linux-only and is deferred to the next PR.
Affected layer
frontend/— React Web UImodule/— Magisk/KernelSU/APatch payload (shell + packagedkasumi-proxybackend)scripts/— build / release helpers.github/Verification
Rust (nix devshell, Linux):
cargo fmt --all --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace— green (proc:: tests pass; shell/proc-only tests gated to unix)cargo run -p kasumi-desktop --bin codegen→git diffonfrontend/src/generatedemptyWindows backend compile is exercised by the new
windows-checkCI job (clippy onwindows-latest). Local cross-check isn't possible here — the nix toolchain ships onlythe host std, no
x86_64-pc-windows-msvcstd.Web UI (
frontend/): n/a — no frontend change.Module shell (
module/): n/a — no shell change.Checklist
Notes for reviewers
pid_matches_bincompares the full image path (no inode on Windows):both sides are
canonicalized, falling back to a case-insensitive compare when thefile is no longer openable (process already exited).
kill'sgracefulflag is a no-op on Windows by design — there is no SIGTERM; thewintun adapter teardown happens on process exit regardless.
wintun packaging + nightly artifact) → PR 3 (promote to release.yml + README).