lkml.org 
[lkml]   [2004]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectAllow userspace do something special on overtemp
Hi!

This patch cleans up thermal.c a bit, and adds possibility to react to
critical overtemp: it tries to call /sbin/overtemp, and only if that
fails calls /sbin/poweroff.

Could it be applied?
Pavel

--- tmp/linux/drivers/acpi/thermal.c 2004-08-11 10:47:04.000000000 +0200
+++ linux/drivers/acpi/thermal.c 2004-08-11 10:45:36.000000000 +0200
@@ -60,7 +60,6 @@
#define ACPI_THERMAL_NOTIFY_HOT 0xF1
#define ACPI_THERMAL_MODE_ACTIVE 0x00
#define ACPI_THERMAL_MODE_PASSIVE 0x01
-#define ACPI_THERMAL_PATH_POWEROFF "/sbin/poweroff"

#define ACPI_THERMAL_MAX_ACTIVE 10

@@ -424,24 +423,25 @@


static int
-acpi_thermal_call_usermode (
- char *path)
+acpi_thermal_call_usermode(void)
{
char *argv[2] = {NULL, NULL};
char *envp[3] = {NULL, NULL, NULL};

ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode");

- if (!path)
- return_VALUE(-EINVAL);
-
- argv[0] = path;
-
/* minimal command environment */
envp[0] = "HOME=/";
envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
-
- call_usermodehelper(argv[0], argv, envp, 0);
+
+ argv[0] = "/sbin/overtemp";
+ if (call_usermodehelper(argv[0], argv, envp, 0)) {
+ argv[0] = "/sbin/poweroff";
+ if (call_usermodehelper(argv[0], argv, envp, 0)) {
+ /* What to do here? Should we just cut the power? */
+ printk(KERN_CRIT "attempts to poweroff failed, please power me down manually\n");
+ }
+ }

return_VALUE(0);
}
@@ -483,7 +483,7 @@
printk(KERN_EMERG "Critical temperature reached (%ld C), shutting down.\n", KELVIN_TO_CELSIUS(tz->temperature));
acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL, tz->trips.critical.flags.enabled);

- acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
+ acpi_thermal_call_usermode();

return_VALUE(0);
}

--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.114 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site