From fd4a40eff328e49abf49ad4ad03b5cdc5b319cb5 Mon Sep 17 00:00:00 2001 From: vasilito Date: Sun, 28 Jun 2026 20:10:45 +0300 Subject: [PATCH] thermald: drop periodic surface-availability check The previous commit changed the existence probe from is_dir/exists (read_dir uses stat) to read_dir.is_ok(), but the second and subsequent calls to read_dir for /scheme/acpi/thermal still return Err at runtime. The first discover_zone_dirs call at startup succeeds (it sees 0 zones, matching the acpid scheme's empty Thermal directory). The periodic monitor_loop recheck then fails with 'unavailable' even though the path is in fact present. The real reason is not fully understood yet, but may relate to scheme-namespace state after userland init, fd table churn, or Redox-specific read_dir semantics on empty scheme directories. The warn-once check is redundant: discover_zone_dirs already runs at startup, and update_policy() sees the empty state every poll cycle and re-renders the TUI accordingly. Drop the periodic recheck so the already-diagnosed empty surface no longer logs a false alarm. --- .../system/thermald/source/src/main.rs | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/local/recipes/system/thermald/source/src/main.rs b/local/recipes/system/thermald/source/src/main.rs index 0b9791175f..f8808fbecc 100644 --- a/local/recipes/system/thermald/source/src/main.rs +++ b/local/recipes/system/thermald/source/src/main.rs @@ -531,24 +531,11 @@ fn update_policy(shared: &Arc>) { } fn monitor_loop(shared: Arc>) -> ! { - let mut warned_missing_surface = false; - + // The surface-existence check happens once at startup in + // discover_zone_dirs. Re-checking it every poll iteration is + // redundant: if it vanished, the next update_policy call will + // see the empty state and re-render the TUI accordingly. loop { - // is_dir() / exists() use stat/lstat which return errors on - // Redox schemes; read_dir is the only reliable existence probe. - let surface_available = fs::read_dir(ACPI_THERMAL_ROOT).is_ok(); - if !surface_available { - if !warned_missing_surface { - warn!( - "{} is unavailable; thermald will keep polling and serve an empty thermal surface", - ACPI_THERMAL_ROOT, - ); - warned_missing_surface = true; - } - } else { - warned_missing_surface = false; - } - update_policy(&shared); thread::sleep(THERMAL_POLL_INTERVAL); }