From b8e8774252fedc0ef1b372f2a1dc8087cb202a65 Mon Sep 17 00:00:00 2001 From: vasilito Date: Sun, 28 Jun 2026 18:54:05 +0300 Subject: [PATCH] thermald, redbear-upower: probe ACPI surface via read_dir Both daemons previously checked /scheme/acpi/thermal (thermald) and /scheme/acpi/power (redbear-upower) existence with Path::exists or is_dir, which use stat/lstat. On Redox these syscalls can return errors for scheme paths even when the scheme IS registered, leading to false 'unavailable' warnings even after the new acpid thermal/ power directories were added. Use fs::read_dir (which already worked for actual zone enumeration) as the existence probe instead. The match expression intentionally calls read_dir to discard the iterator and keep only the Result; using ? here would break the warn-once pattern. --- local/recipes/system/redbear-upower/source/src/main.rs | 4 +++- local/recipes/system/thermald/source/src/main.rs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/local/recipes/system/redbear-upower/source/src/main.rs b/local/recipes/system/redbear-upower/source/src/main.rs index 28b9813fab..7b612997f3 100644 --- a/local/recipes/system/redbear-upower/source/src/main.rs +++ b/local/recipes/system/redbear-upower/source/src/main.rs @@ -211,7 +211,9 @@ impl PowerRuntime { } fn available(&self) -> bool { - self.root.exists() + // is_dir() uses stat which misbehaves on Redox schemes; read_dir + // is the only reliable existence probe. + self.root.read_dir().is_ok() } fn adapter_dir(&self, id: &str) -> PathBuf { diff --git a/local/recipes/system/thermald/source/src/main.rs b/local/recipes/system/thermald/source/src/main.rs index 7a38249872..0b9791175f 100644 --- a/local/recipes/system/thermald/source/src/main.rs +++ b/local/recipes/system/thermald/source/src/main.rs @@ -534,7 +534,10 @@ fn monitor_loop(shared: Arc>) -> ! { let mut warned_missing_surface = false; loop { - if !Path::new(ACPI_THERMAL_ROOT).exists() { + // 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",