3.4 KiB
3.4 KiB
System Process, Shared Watcher, Durable Filesystem & Temp Factories
Task ID: M-SYSTEM-01..05 Phase: P2 (Wave 6A) Status: APPROVED Contracts: C-01, C-02, C-03, C-04, C-05
1. Context and baseline
Void::System preserves 1.x APIs (Void::Process::{run,run_streaming,shell,reexec}, Void::FileSystem::{FileWatcher,Path,Query,TempFile,TempDir}, Void::SystemInfo::CpuSampler) while fixing legacy bugs (zero-timeout 30s cutoff, full-duplex pipe deadlock, unescalated SIGTERM wait hangs, SIGPIPE on pipes, TOCTOU temp creation, unsafe atomic_write) and adding System (Types, OwnedFd, Child, spawn, communicate_blocking, replace_file, bounded read_file/list_directory, valid CpuSampler::sample) plus Void::SystemAsync (ProcessManager, async communicate/wait, shared WatcherService, WatchSubscription).
2. Deliverables
src/System/module.cmake(INTERNAL_DEPS Functional Time LogState,EXCLUDE_HEADERS Void/System/AsyncProcess.hpp Void/System/AsyncWatcher.hpp) &src/SystemAsync/module.cmake(INTERNAL_DEPS System Async IO Time Functional LogState).include/Void/System/Types.hpp:kSystemErrorDomain = 10,SystemErrorCode,make_system_error, move-onlyOwnedFd.include/Void/System/Process.hpp&src/System/Process.cpp: legacy compatibility fixes +SpawnOptions,EnvironmentPolicy,CaptureLimits,OverflowPolicy,kMaxSpawnInputBytes = 256 KiB, move-onlyChild,spawn,communicate_blocking,reexec(..., close_extra_fds).include/Void/System/{Path,Query,TempFile,TempDir,Metrics}.hpp:read_file_bounded,list_directory_bounded,replace_filewithReplaceDurability/ReplacePhase/ReplaceFaultHook, atomic0600/0700TempFile/TempDirverified by(dev, ino)before removal,CpuSample.include/Void/System/{AsyncProcess,AsyncWatcher}.hpp&src/SystemAsync/{AsyncProcess,AsyncWatcher}.cpp:ProcessManager, asynccommunicate/wait/close_and_join, sharedWatcherService,WatchSubscription.tests/helpers/ProcessHelper.cpp,tests/standalone/System/{ProcessStream,SystemHardening}.cpp,tests/standalone/SystemAsync/SystemAsync.cpp,tests/package/{SystemOnly,SystemAsyncOnly}/*.
3. Edge cases
- Between
fork()andexec*(), strictly async-signal-safe operations only;exec_failedpreserveserrnoviaCLOEXECerror pipe and never collides with child exit127. replace_filecleans only owned temp files before rename and reportsvisible_on_disk = true, durability_unknown = trueif post-rename directoryfsyncfails.WatcherService::close_and_join()drains admitted callbacks and rejects self-join.
4. Verification commands
dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w6a-system -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVOID_ENABLED_MODULES="System;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w6a-system && /tmp/void-w6a-system/tests/VoidTests --filter "Process*|SystemHardening*|Path*|Query*|TempDir*|TempFile*|Metrics*|FileWatcher*|SignalWatcher*" && ctest --test-dir /tmp/void-w6a-system --output-on-failure --timeout 120'
dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w6a-sysasync -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVOID_ENABLED_MODULES="SystemAsync;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w6a-sysasync && /tmp/void-w6a-sysasync/tests/VoidTests --filter "SystemAsync*" && ctest --test-dir /tmp/void-w6a-sysasync --output-on-failure --timeout 120'