Plugin: copy_on_load option; unique hotswap temp names

- copy_on_load: dlopen a fresh-inode temp copy on first load (reloads
  already did), so deployments that rewrite the plugin file in place —
  e.g. a build writing its output — cannot corrupt the mapped image.
  The registry keeps addressing the original path for watch/reload.
- hotswap_copy now generates a unique temp name per copy. glibc dedupes
  dlopen by pathname, so the previous fixed ".void_hotswap" name made
  every second reload through the same path silently return the
  already-mapped OLD image instead of the new bytes.
- hot_reload_under_concurrent_load now asserts the true downgrade
  semantics (v2 -> v1 is rejected transactionally, v2 stays); it only
  ever passed the old all-succeed expectation via the dedup bug, since
  no flip after the first actually took effect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yj92cCihyaYtf4gKCT3nv
This commit is contained in:
faumarayandClaude Fable 5 committed 2026-07-11 23:46:21 +03:00
1 parent ee4486e1d2
commit a06f639393
4 files changed
+80 -12

No files matched your search

+6
View File
@@ -74,6 +74,12 @@ namespace Void::Plugin
// executing would crash. Pins already prevent the instance from
// being destroyed; this guards the code pages.
bool dlclose_on_swap = false;
// dlopen a fresh-inode temp copy instead of the original file on
// the first load (reloads already do). Turn on when deployments
// overwrite the plugin file in place (e.g. a build writing its
// output) — mapping the original would then corrupt the running
// image (SIGBUS). The registry keeps tracking the original path.
bool copy_on_load = false;
// Per-plugin configuration source. When set, its result is passed
// to the plugin's optional void_plugin_configure entry point after
// create and after each reload swap, before on_load(). The plugin