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.
This commit is contained in:
2026-06-28 20:10:45 +03:00
parent 24a66ac8dd
commit fd4a40eff3
@@ -531,24 +531,11 @@ fn update_policy(shared: &Arc<RwLock<ThermalState>>) {
}
fn monitor_loop(shared: Arc<RwLock<ThermalState>>) -> ! {
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);
}