Skip to content

Add nonunix platform support (libmultiprocess v14) - #110

Draft
Sjors wants to merge 12 commits into
stratum-mining:masterfrom
Sjors:2026/06/nonunix
Draft

Sjors wants to merge 12 commits into
stratum-mining:masterfrom
Sjors:2026/06/nonunix

Conversation

@Sjors

@Sjors Sjors commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

This tracks:

The subtree update is not strictly needed in this PR, because of the shims, but I prefer to it over with. Shims are dropped in the last commit.

@Sjors
Sjors force-pushed the 2026/06/nonunix branch 5 times, most recently from 11ac490 to 14a8fe7 Compare June 23, 2026 16:05
@Sjors Sjors changed the title Add nonunix platform support Add nonunix platform support (libmultiprocess v14) Jul 21, 2026
ryanofsky and others added 12 commits July 21, 2026 12:52
Pass exe_name parameter to ipc::Protocol class constructor instead. It never
really made sense to have exe parameters as part of the protocol interface and
removing them makes adding new features like Windows support easier.

The exe name values are only used for logging and debugging purposes to
distinguish log messages from different processes.

This commit is based on 33d37f3c35efaac136863253b91799bf2711fd46 with
the bitcoin/bitcoin changes to src/ipc/test/ipc_tests.cpp omitted.

Co-authored-by: OpenAI Codex 5.6 Sol <noreply@openai.com>
This just changes Protocol class field order to make sure class members are not
destroyed before the event loop thread exits. There is no change in behavior.
The change is just being made to clarify intent and avoid potential bugs.
Keep standard headers separate from posix headers
Avoid compile error from MSVC:

D:\a\bitcoin\bitcoin\src\ipc\interfaces.cpp(24,1): error C1083: Cannot open include file: 'unistd.h': No such file or directory

MinGW provides this header but MSVC does not. Header is unneeded on windows
because HandleCtrlC code that uses it is not compiled on windows.
Use ProcessId type instead of int to represent process ids to be
compatible with an upcoming version of libmultiprocess which adds
windows support.
Use SocketId type instead of int to represent socket ids to be
compatible with an upcoming version of libmultiprocess which adds
Windows support.

This commit is based on 3859805f05e6fb642140c89e6d7378203e04df2c with
the bitcoin/bitcoin changes to src/ipc/test/ipc_tests.cpp omitted.

Co-authored-by: OpenAI Codex 5.6 Sol <noreply@openai.com>
Use Stream type to abstract socket ids and be compatible with updated
mp::ConnectStream() and mp::ServeStream() functions that use streams
instead of socket ids in an upcoming version of libmultiprocess which
adds Windows support.

Since creating Stream objects from socket ids can require the event loop
to be running, the ipc::Protocol::serve() method is also updated to
accept the server stream through a callback parameter instead of a normal
parameter.

This commit is based on e9f19815caa3e129020f116bef43d409cb50a475 with
the bitcoin/bitcoin changes to src/ipc/test/ipc_tests.cpp omitted.

Co-authored-by: OpenAI Codex 5.6 Sol <noreply@openai.com>
Use new SpawnProcess and StartSpawned functions to be compatible with an
upcoming version of libmultiprocess which adds windows support.
Wrap socketpair descriptors with libmultiprocess streams before passing
them to ConnectStream and ServeStream. This updates the sv2 test harness
after cherry-picking the Bitcoin Core IPC stream refactor.

Co-authored-by: OpenAI Codex 5.6 Sol <noreply@openai.com>
3f221b5bfd Merge bitcoin-core/libmultiprocess#274: Add nonunix platform support
1b0f605606 doc: Remove trailing whitespace
d8f8ca3119 ipc: Wrap mpgen main() in try-catch to print errors
fbe5a14ad4 ci: Check out bitcoin/bitcoin PR #35084 instead of master
39d3690d83 types: Replace SFINAE with requires clauses to avoid MSVC C2039 error
ba68520203 proxy, refactor: Fix C4305 truncation warning in Accessor on MSVC
1d81d47811 util, refactor: Fix PtrOrValue constructor for move-only types on MSVC
b883fe1e52 proxy: Fix shutdownWrite() exception handling on macOS with dynamic libraries
0012411ccc proxy: Call shutdownWrite() in Connection destructor
38312ad191 proxy, refactor: Change ConnectStream and ServeStream to accept stream objects
e96d5d742a proxy, refactor: Replace EventLoop wakeup fd integers with KJ stream objects
db4f9a3d73 cmake: Bump minimum required Cap'n Proto version to 0.9
652934fb79 util, refactor: Add SocketPair() and use it in SpawnProcess
1c6ef7a26c util, refactor: Do not fork() and exec() separately
1389cf3132 util, refactor: Add SpawnConnectInfo type alias and use it
c7ca1f00b6 util, refactor: Add SocketId type alias and use it
be46a35203 util, refactor: Add ProcessId type alias and use it
91a78db780 doc: Bump version 13 > 14

git-subtree-dir: src/ipc/libmultiprocess
git-subtree-split: 3f221b5bfd7ee0e7972e3c5ed4bb7ee86e457f6d
The embedded libmultiprocess subtree now provides the v14 ProcessId,
SocketId, Stream, and process spawning APIs directly.

Co-authored-by: OpenAI Codex 5.6 Sol <noreply@openai.com>
@Sjors
Sjors force-pushed the 2026/06/nonunix branch from 14a8fe7 to 1f12ef2 Compare July 21, 2026 10:56
@Sjors

Sjors commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased after #113. The subtree update here is now from v13 to v14, in order to pull in bitcoin-core/libmultiprocess#274.

Just waiting for the Bitcoin Core PR to be merged, in order to minimize drift with our implementation.

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.

2 participants