Skip to content

Windows backend for msgq and visionipc - #1

Closed
AmyJeanes wants to merge 4 commits into
windows-basefrom
windows
Closed

Windows backend for msgq and visionipc#1
AmyJeanes wants to merge 4 commits into
windows-basefrom
windows

Conversation

@AmyJeanes

Copy link
Copy Markdown
Owner

Fork-internal draft: runs this repository's own CI on the windows series before it is proposed upstream. Not for merging.

🤖 Generated with Claude Code

https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt

@AmyJeanes AmyJeanes closed this Sep 7, 2026
@AmyJeanes AmyJeanes reopened this Sep 7, 2026
@AmyJeanes AmyJeanes closed this Sep 7, 2026
@AmyJeanes AmyJeanes reopened this Sep 7, 2026
@AmyJeanes
AmyJeanes changed the base branch from master to windows-base September 7, 2026 18:43
AmyJeanes and others added 4 commits September 7, 2026 21:06
Queues and the fake-event state are named shared-memory sections rather
than files: Windows has no /dev/shm, a section needs no cleanup (the
kernel drops it with its last handle or view, where a Linux queue file
stays until reboot) and queue files could not be swept safely, since an
NTFS delete succeeds on a file that is only mapped and leaves the mapping
attached to an orphan. A section keeps its name only while a handle to
it is open, so every mapping holds one for its lifetime: the queue struct
carries it and the event state keeps one per view. msgq_shm_dir() picks
the queue directory on Linux and macOS (/dev/shm, /tmp) instead of three
ifdef ladders; on Windows it locates the visionipc sockets under %TEMP%,
"/tmp" being the current drive's root there.

Readers block in msgq_poll() on a per-thread named event which publishers
signal by thread id, replacing the SIGUSR2/tkill wakeup; the wait loops
until the steady clock passes the deadline, since WaitForSingleObject's
timeout runs on the interrupt clock and can expire a few microseconds
early. Fake events use named Win32 events instead of FIFOs.

visionipc uses AF_UNIX stream sockets with length-prefixed messages. The
buffers are anonymous sections whose handles the server duplicates into
the client process, the Windows form of SCM_RIGHTS; the socket reports
the peer's pid (SIO_AF_UNIX_GETPEERPID).

The C++ tests now release their queues: a section is created afresh once
nobody maps it, where the tests used to rely on deleting the queue file.

test_receive_timeout measures with perf_counter: on Windows Python 3.12
time.monotonic() is the 15.6 ms tick clock and read a 5 ms wait as 0 ms
about once in a hundred runs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
toggle_fake_events() and set_fake_prefix() set CEREAL_FAKE* through the
C runtime's putenv. Python's os.environ is a snapshot taken at startup,
and on Windows multiprocessing spawns children from that snapshot (in a
venv it hands os.environ.copy() to CreateProcess), so the replayed
process in process_replay never entered fake mode and the test waited
for it forever. Keep os.environ in sync from the Python wrappers; a
forked child on Linux inherits both anyway.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
Python imports extension modules as .pyd on Windows. The cython tool
renames the .so targets the SConscripts declare, so neither they nor a
SConstruct that loads the tool has to know.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
Windows checkouts default to CRLF, which breaks the shell scripts and
makes every file look modified from an MSYS2 shell.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
@AmyJeanes

Copy link
Copy Markdown
Owner Author

Superseded by commaai#709: comma's CI runs on the upstream PR now. The follow-up (#2) stacks on the windows branch and stays open.

@AmyJeanes AmyJeanes closed this Sep 7, 2026
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