From: Pavel Machek <pavel@suse.cz>
To: trenn@suse.de, seife@suse.de,
kernel list <linux-kernel@vger.kernel.org>,
Len Brown <len.brown@intel.com>
Subject: Allow userspace do something special on overtemp
Date: Wed, 11 Aug 2004 10:53:26 +0200 [thread overview]
Message-ID: <20040811085326.GA11765@elf.ucw.cz> (raw)
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!
next reply other threads:[~2004-08-11 8:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-11 8:53 Pavel Machek [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040811085326.GA11765@elf.ucw.cz \
--to=pavel@suse.cz \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=seife@suse.de \
--cc=trenn@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome