linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Allow userspace do something special on overtemp
@ 2004-08-11  8:53 Pavel Machek
  2004-08-11  9:03 ` Arjan van de Ven
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Pavel Machek @ 2004-08-11  8:53 UTC (permalink / raw)
  To: trenn, seife, kernel list, Len Brown

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!

^ permalink raw reply	[flat|nested] 25+ messages in thread
[parent not found: <fa.fd8nc62.oig6ao@ifi.uio.no>]

end of thread, other threads:[~2004-08-13  4:28 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-11  8:53 Allow userspace do something special on overtemp Pavel Machek
2004-08-11  9:03 ` Arjan van de Ven
2004-08-11  9:06   ` Pavel Machek
2004-08-11 14:49     ` Len Brown
2004-08-11 14:52       ` Wichert Akkerman
2004-08-11 15:28       ` Thomas Renninger
2004-08-11 21:08         ` Kronos
2004-08-11 20:26       ` Pavel Machek
2004-08-11  9:18   ` Måns Rullgård
2004-08-11 18:22     ` Olaf Hering
     [not found] ` <411A239C.8060606@blue-labs.org>
2004-08-11 20:22   ` Pavel Machek
2004-08-12  0:08 ` Dax Kelson
2004-08-12  3:29   ` Len Brown
2004-08-12  7:40     ` Pavel Machek
2004-08-12 14:28       ` Len Brown
2004-08-12 20:24         ` Pavel Machek
2004-08-12 22:51           ` Len Brown
2004-08-12 23:21             ` Pavel Machek
2004-08-12  7:35   ` Pavel Machek
2004-08-12 15:19 ` Len Brown
2004-08-12 15:16   ` Randy.Dunlap
2004-08-12 15:50     ` Stefan Seyfried
2004-08-12 17:27   ` [ACPI] " Stefan Dösinger
2004-08-12 22:53     ` Len Brown
     [not found] <fa.fd8nc62.oig6ao@ifi.uio.no>
     [not found] ` <fa.g1p407b.1c569pj@ifi.uio.no>
2004-08-13  4:22   ` Robert Hancock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).