diff --git a/cmake/Targets.cmake b/cmake/Targets.cmake index bdbe25a..2a2610a 100644 --- a/cmake/Targets.cmake +++ b/cmake/Targets.cmake @@ -49,7 +49,15 @@ set(VOID_WINDOWS_MODULES Async Binary Configuration + ConfigurationAsync Containers + FunctionalCoreFormatting + LogConfig + MCP + Resilience + ResilienceAsync + Script + SystemAsync Core Crypto Data diff --git a/src/SystemAsync/AsyncWatcher.cpp b/src/SystemAsync/AsyncWatcher.cpp index 66a78f5..b0d2640 100644 --- a/src/SystemAsync/AsyncWatcher.cpp +++ b/src/SystemAsync/AsyncWatcher.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -90,7 +91,43 @@ struct PathSnapshot { } } #else - (void)path; + // Windows: the same fields through std::filesystem (no device/inode + // identity; size, mtime and type drive change detection). + std::error_code ec; + const auto status = std::filesystem::symlink_status(path, ec); + if (ec) { + snap.sys_errno = ec.value(); + snap.permission_denied = ec == std::errc::permission_denied; + return snap; + } + snap.exists = std::filesystem::exists(status); + if (!snap.exists) { + snap.sys_errno = ENOENT; + return snap; + } + snap.is_symlink = std::filesystem::is_symlink(status); + if (std::filesystem::is_directory(status)) { + snap.mode = 0040755U; // S_IFDIR | 0755 + } else { + snap.mode = 0100644U; // S_IFREG | 0644 + snap.size = std::filesystem::file_size(path, ec); + if (ec) { + snap.size = 0; + ec.clear(); + } + } + const auto mtime = std::filesystem::last_write_time(path, ec); + if (!ec) { + snap.mtime_ns = std::chrono::duration_cast( + mtime.time_since_epoch()) + .count(); + } + if (snap.is_symlink) { + const auto target = std::filesystem::read_symlink(path, ec); + if (!ec) { + snap.symlink_target = target.string(); + } + } #endif return snap; } diff --git a/tests/standalone/ConfigurationAsync/ConfigurationAsync.cpp b/tests/standalone/ConfigurationAsync/ConfigurationAsync.cpp index 74ad2b8..6e339fb 100644 --- a/tests/standalone/ConfigurationAsync/ConfigurationAsync.cpp +++ b/tests/standalone/ConfigurationAsync/ConfigurationAsync.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include namespace void_cfg_async_test @@ -316,8 +317,18 @@ Void::Testing::Test config_async_watcher_coalescing_and_prepare_external() Void::FileSystem::write_file(cfg_path, R"({"host":"watched","port":8099})") .has_value()); - watcher.poll_once(); - (void)exec.drain(); + // File events are asynchronous (inotify on Linux, ReadDirectoryChangesW + // on Windows): poll until the reload is delivered. + bool reloaded = false; + for (int attempt = 0; attempt < 200 && !reloaded; ++attempt) { + watcher.poll_once(); + (void)exec.drain(); + reloaded = ctrl->current().values->host == "watched"; + if (!reloaded) { + std::this_thread::sleep_for(std::chrono::milliseconds{5}); + } + } + Void::Testing::expect(reloaded); Void::Testing::expect_eq(ctrl->current().values->host, std::string{"watched"}); Void::Testing::expect_eq(ctrl->current().values->port, 8099); diff --git a/tests/standalone/SystemAsync/SystemAsyncShutdown.cpp b/tests/standalone/SystemAsync/SystemAsyncShutdown.cpp index 237b071..cd5b073 100644 --- a/tests/standalone/SystemAsync/SystemAsyncShutdown.cpp +++ b/tests/standalone/SystemAsync/SystemAsyncShutdown.cpp @@ -125,6 +125,9 @@ public: Void::Testing::Test systemasync_driver_shutdown_pending_pipe_read_retains_and_delivers_once() { +#ifdef _WIN32 + Void::Testing::skip("POSIX process helper is not available on Windows"); +#endif ScopedTempDir dir; require(dir.valid()); const auto path = dir.file("pipe_gate.bin");