Standardize shutdown of the system from enviroment control modules
Subsystems (2)
Currently snsc_event for Altix systems sends SIGPWR to init (and abuses tasklist_lock..) while the sbus drivers call execve for /sbin/shutdown (which is also ugly, it should at least use call_usermodehelper) With normal sysvinit both will end up the same, but I suspect the shutdown variant, maybe with a sysctl to chose the exact path to call would be cleaner. What do you guys think about adding a common function to do this. Could you test such a patch for me?
Quoted 7 lines · Christoph Hellwig
Currently
snsc_eventfor Altix systems sends SIGPWR to init (and abusestasklist_lock..) while the sbus drivers call execve for/sbin/shutdown(which is also ugly, it should at least usecall_usermodehelper) With normal sysvinit both will end up the same, but I suspect the shutdown variant, maybe with a sysctl to chose the exact path to call would be cleaner. What do you guys think about adding a common function to do this.
Sounds reasonable to me. I'll copy Aaron Young, who I think actually wrote the code to send the SIGPWR, in case he had a Good Reason for doing it this way. (Aaron, if I'm remembering wrong and you're not the guy who wrote this, let me know...)
Quoted 1 line
Could you test such a patch for me?
Sure. I'll need to get hold of some hardware/firmware that will reproduce a critical environmental situation... Might take a litte while...
Thanks
--
Greg Howard, MTS - Core Platform SW MS 10-1-061 SGI - Silicon Graphics Inc. 2750 Blue Water Road [email protected] Eagan, MN 55121
+--------------------------------------------------------------------+ "This assignment has two parts: a hard part, and an easy part. Do
the easy part first; you might learn something that will help you on the hard part. Or, maybe you'll go outside for a walk before you start the hard part, and get hit by a truck!"
- Dr. Jeffrey W. Smith
+--------------------------------------------------------------------+
Re: Standardize shutdown of the system from enviroment control
Quoted 12 lines · Christoph Hellwig
Quoted 8 lines
Currently
snsc_eventfor Altix systems sends SIGPWR to init (and abusestasklist_lock..) while the sbus drivers call execve for/sbin/shutdown(which is also ugly, it should at least usecall_usermodehelper) With normal sysvinit both will end up the same, but I suspect the shutdown variant, maybe with a sysctl to chose the exact path to call would be cleaner. What do you guys think about adding a common function to do this.
Quoted 4 lines
Sounds reasonable to me. I'll copy Aaron Young, who I think actually wrote the code to send the SIGPWR, in case he had a Good Reason for doing it this way. (Aaron, if I'm remembering wrong and you're not the guy who wrote this, let me know...)
Yep, that was me. I couldn't really find a better way to do it at the time. An 'execve shutdown' probably would have been better in retrospect because I think sending SIGPWR to init doesn't always shutdown the machine. It depends on how some config files are setup (inittab, powerfail). I'd rather not depend on any config files and just force a shutdown/poweroff.
Quoted 6 lines
Quoted 2 lines
Could you test such a patch for me?
Sure. I'll need to get hold of some hardware/firmware that will reproduce a critical environmental situation... Might take a litte while...
Testing should be easy - on a Deskside Prism system, just hit the power button while up at Linux.
Hi!
Quoted 7 lines
Currently
snsc_eventfor Altix systems sends SIGPWR to init (and abusestasklist_lock..) while the sbus drivers call execve for/sbin/shutdown(which is also ugly, it should at least usecall_usermodehelper) With normal sysvinit both will end up the same, but I suspect the shutdown variant, maybe with a sysctl to chose the exact path to call would be cleaner. What do you guys think about adding a common function to do this. Could you test such a patch for me?
ACPI does some exec (in thermal), too. Yes, I think it is worth standartizing. Easy to test, btw, just echo too low trippoints.
Pavel
Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
RFC PATCH 1/1 Standardize shutdown of the system from enviroment control modules
In reply to Christoph HellwigQuoted 7 lines · Christoph Hellwig
Currently
snsc_eventfor Altix systems sends SIGPWR to init (and abusestasklist_lock..) while the sbus drivers call execve for/sbin/shutdown(which is also ugly, it should at least usecall_usermodehelper) With normal sysvinit both will end up the same, but I suspect the shutdown variant, maybe with a sysctl to chose the exact path to call would be cleaner. What do you guys think about adding a common function to do this. Could you test such a patch for me?
Okay, here's such a patch, I've also switched the SN and the two sbus drivers over.
drivers/char/snsc_event.c +1 -18
@@ -195,24 +195,7 @@ severity =scdrv_event_severity (code);if ((code &EV_CLASS_MASK ) ==EV_CLASS_PWRD_NOTIFY ) { -struct task_struct *p; - -/* give a SIGPWR signal to init proc */ - -/* first find init's task */ -read_lock (&tasklist_lock); -for_each_process (p) { -if (p->pid ==1 ) -break ; - } -if (p) {/* we found init's task */ -printk (KERN_EMERG "Power off indication received. Initiating power fail sequence...\n" ); -force_sig (SIGPWR , p); - }else {/* failed to find init's task - just give message(s) */ -printk (KERN_WARNING "Failed to find init proc to handle power off!\n" ); -printk ("%s|$(0x%x)%s\n" , severity, esp_code, desc); - } -read_unlock (&tasklist_lock); +envctrl_do_shutdown (); }else {/* print to system log */ printk ("%s|$(0x%x)%s\n" , severity, esp_code, desc);
drivers/sbus/char/bbc_envctrl.c +3 -6
@@ -4,13 +4,12 @@* Copyright (C) 2001 David S. Miller ([email protected]) */ -#define __KERNEL_SYSCALLS__ -#include <linux/kernel.h> #include <linux/kthread.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/delay.h> +#include <linux/envctrl.h> #include <asm/oplib.h> #include <asm/ebus.h> static int errno;
@@ -176,8 +175,6 @@static void do_envctrl_shutdown (struct bbc_cpu_temperature *tp) {static int shutting_down =0 ; -static char *envp[] = {"HOME=/" ,"TERM=linux" ,"PATH=/sbin:/usr/sbin:/bin:/usr/bin" ,NULL }; -char *argv[] = {"/sbin/shutdown" ,"-h" ,"now" ,NULL };char *type ="???" ;s8 val =-1 ;
@@ -201,8 +198,8 @@printk (KERN_CRIT "kenvctrld: Shutting down the system now.\n" ); shutting_down =1 ; -if (execve ("/sbin/shutdown" , argv, envp) <0 ) -printk (KERN_CRIT "envctrl: shutdown execution failed\n" ); + +envctrl_do_shutdown (); }#define WARN_INTERVAL (30 * HZ)
drivers/sbus/char/envctrl.c +1 -21
@@ -19,8 +19,6 @@* Daniele Bellucci <[email protected]> */ -#define __KERNEL_SYSCALLS__ -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h>
@@ -33,6 +31,7 @@#include <linux/mm.h> #include <linux/slab.h> #include <linux/kernel.h> +#include <linux/envctrl.h> #include <asm/ebus.h> #include <asm/uaccess.h>
@@ -975,25 +974,6 @@return NULL ; } -static void envctrl_do_shutdown (void ) -{ -static int inprog =0 ; -static char *envp[] = { -"HOME=/" ,"TERM=linux" ,"PATH=/sbin:/usr/sbin:/bin:/usr/bin" ,NULL }; -char *argv[] = { -"/sbin/shutdown" ,"-h" ,"now" ,NULL }; - -if (inprog !=0 ) -return ; - - inprog =1 ; -printk (KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n" ); -if (0 >execve ("/sbin/shutdown" , argv, envp)) { -printk (KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n" ); - inprog =0 ;/* unlikely to succeed, but we could try again */ - } -} -static struct task_struct *kenvctrld_task;static int kenvctrld (void *__unused)
include/linux/envctrl.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _LINUX_ENVCTRL_H +#define _LINUX_ENVCTRL_H + +extern int envctrl_do_shutdown (void ); + +#endif /* _LINUX_ENVCTRL_H */
kernel/Makefile +1 -1
@@ -7,7 +7,7 @@ sysctl.o capability.o ptrace.o timer.o user.o \ signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o intermodule.o extable.o params.o posix-timers.o \ - kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o + kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o envctrl.o obj-$(CONFIG_FUTEX) += futex.o obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
kernel/envctrl.c new file +46 -0
46 lines not on this page · raw message
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Christoph Hellwig
Currently
snsc_eventfor Altix systems sends SIGPWR to init (and abusestasklist_lock..) while the sbus drivers call execve for/sbin/shutdown(which is also ugly, it should at least usecall_usermodehelper) With normal sysvinit both will end up the same, but I suspect the shutdown variant, maybe with a sysctl to chose the exact path to call would be cleaner. What do you guys think about adding a common function to do this. Could you test such a patch for me?Okay, here's such a patch, I've also switched the SN and the two sbus drivers over.
ping?
Quoted 184 lines
Signed-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/drivers/char/snsc_event.c
===================================================================drivers/char/snsc_event.c +1
-18@@ -195,24 +195,7 @@ severity =scdrv_event_severity (code);if ((code &EV_CLASS_MASK ) ==EV_CLASS_PWRD_NOTIFY ) { -struct task_struct *p; - -/* give a SIGPWR signal to init proc */ - -/* first find init's task */ -read_lock (&tasklist_lock); -for_each_process (p) { -if (p->pid ==1 ) -break ; - } -if (p) {/* we found init's task */ -printk (KERN_EMERG "Power off indication received. Initiating power fail sequence...\n" ); -force_sig (SIGPWR , p); - }else {/* failed to find init's task - just give message(s) */ -printk (KERN_WARNING "Failed to find init proc to handle power off!\n" ); -printk ("%s|$(0x%x)%s\n" , severity, esp_code, desc); - } -read_unlock (&tasklist_lock); +envctrl_do_shutdown (); }else {/* print to system log */ printk ("%s|$(0x%x)%s\n" , severity, esp_code, desc);Index:
linux-2.6/drivers/sbus/char/bbc_envctrl.c
===================================================================drivers/sbus/char/bbc_envctrl.c +3
-6@@ -4,13 +4,12 @@* Copyright (C) 2001 David S. Miller ([email protected]) */ -#define __KERNEL_SYSCALLS__ -#include <linux/kernel.h> #include <linux/kthread.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/delay.h> +#include <linux/envctrl.h> #include <asm/oplib.h> #include <asm/ebus.h> static int errno;@@ -176,8 +175,6 @@static void do_envctrl_shutdown (struct bbc_cpu_temperature *tp) {static int shutting_down =0 ; -static char *envp[] = {"HOME=/" ,"TERM=linux" ,"PATH=/sbin:/usr/sbin:/bin:/usr/bin" ,NULL }; -char *argv[] = {"/sbin/shutdown" ,"-h" ,"now" ,NULL };char *type ="???" ;s8 val =-1 ;@@ -201,8 +198,8 @@printk (KERN_CRIT "kenvctrld: Shutting down the system now.\n" ); shutting_down =1 ; -if (execve ("/sbin/shutdown" , argv, envp) <0 ) -printk (KERN_CRIT "envctrl: shutdown execution failed\n" ); + +envctrl_do_shutdown (); }#define WARN_INTERVAL (30 * HZ)Index:
linux-2.6/drivers/sbus/char/envctrl.c
===================================================================drivers/sbus/char/envctrl.c +1
-21@@ -19,8 +19,6 @@* Daniele Bellucci <[email protected]> */ -#define __KERNEL_SYSCALLS__ -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> @@ -33,6 +31,7 @@#include <linux/mm.h> #include <linux/slab.h> #include <linux/kernel.h> +#include <linux/envctrl.h> #include <asm/ebus.h> #include <asm/uaccess.h> @@ -975,25 +974,6 @@return NULL ; } -static void envctrl_do_shutdown (void ) -{ -static int inprog =0 ; -static char *envp[] = { -"HOME=/" ,"TERM=linux" ,"PATH=/sbin:/usr/sbin:/bin:/usr/bin" ,NULL }; -char *argv[] = { -"/sbin/shutdown" ,"-h" ,"now" ,NULL }; - -if (inprog !=0 ) -return ; - - inprog =1 ; -printk (KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n" ); -if (0 >execve ("/sbin/shutdown" , argv, envp)) { -printk (KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n" ); - inprog =0 ;/* unlikely to succeed, but we could try again */ - } -} -static struct task_struct *kenvctrld_task;static int kenvctrld (void *__unused)Index:
linux-2.6/include/linux/envctrl.h
===================================================================include/linux/envctrl.h new file +6
-0@@ -0,0 +1,6 @@ +#ifndef _LINUX_ENVCTRL_H +#define _LINUX_ENVCTRL_H + +extern int envctrl_do_shutdown (void ); + +#endif /* _LINUX_ENVCTRL_H */ Index: linux-2.6/kernel/Makefile
===================================================================kernel/Makefile +1
-1@@ -7,7 +7,7 @@ sysctl.o capability.o ptrace.o timer.o user.o \ signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o intermodule.o extable.o params.o posix-timers.o \ - kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o + kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o envctrl.o obj-$(CONFIG_FUTEX) += futex.o obj-$(CONFIG_GENERIC_ISA_DMA) += dma.oIndex:
linux-2.6/kernel/envctrl.c
===================================================================kernel/envctrl.c new file +36
-0@@ -0,0 +1,46 @@ +/* +* Copyright (C) 2001 David S. Miller. +* Copyright (C) 2005 Christoph Hellwig. +* Released under GPL v2. +* +* Common code to shutdown the system when overheating. +*/ + +#include <linux/envctrl.h> +#include <linux/kernel.h> +#include <linux/kmod.h> + +static char *envp[] = { +"HOME=/" ,"TERM=linux" ,"PATH=/sbin:/usr/sbin:/bin:/usr/bin" ,NULL +}; + +static char *argv[] = { +"/sbin/shutdown" ,"-h" ,"now" ,NULL +}; + +/* +* envctrl_do_shutdown - shut the system down when overheating +* +* Common routine to be called from all enviromental monitoring +* drivers when a fatal overheating is detected. +* +* Returns 0 if /sbin/shutdown has been called sucessfully, 1 if +* this routine has been called already but the kernel is still +* running or a negative error value if executing the shutdown +* command failed. +*/ +int envctrl_do_shutdown (void ) +{ +static int shutting_down =0 ; +int error; +
kernel/envctrl.c line 46
Quoted 10 lines
kernel/envctrl.c new file +10
-0+if (shutting_down) +return 1 ; + shutting_down =1 ; + +printk (KERN_CRIT "envctrl: WARNING: Shutting down the system now.\n" ); + error =call_usermodehelper ("/sbin/shutdown" , argv, envp,0 ); +if (error) +printk (KERN_CRIT "envctrl: WARNING: system shutdown failed!\n" ); +return error; +}
---end quoted text---
Quoted 10 lines · Christoph Hellwig
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · Christoph Hellwig
Currently
snsc_eventfor Altix systems sends SIGPWR to init (and abusestasklist_lock..) while the sbus drivers call execve for/sbin/shutdown(which is also ugly, it should at least usecall_usermodehelper) With normal sysvinit both will end up the same, but I suspect the shutdown variant, maybe with a sysctl to chose the exact path to call would be cleaner. What do you guys think about adding a common function to do this. Could you test such a patch for me?
Quoted 4 lines
Quoted 2 lines
Okay, here's such a patch, I've also switched the SN and the two sbus drivers over.
ping?
Hi Christoph,
Got your patch and built it into a kernel... Ran into other (unrelated) difficulties booting said kernel... I'll see if I can get that sorted out today and test drive it.
Quoted 1 line
From inspection I don't see any problem with the patch.
Thanks - Greg
Quoted 188 lines
Quoted 188 lines
Signed-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/drivers/char/snsc_event.c
===================================================================drivers/char/snsc_event.c +1
-18@@ -195,24 +195,7 @@ severity =scdrv_event_severity (code);if ((code &EV_CLASS_MASK ) ==EV_CLASS_PWRD_NOTIFY ) { -struct task_struct *p; - -/* give a SIGPWR signal to init proc */ - -/* first find init's task */ -read_lock (&tasklist_lock); -for_each_process (p) { -if (p->pid ==1 ) -break ; - } -if (p) {/* we found init's task */ -printk (KERN_EMERG "Power off indication received. Initiating power fail sequence...\n" ); -force_sig (SIGPWR , p); - }else {/* failed to find init's task - just give message(s) */ -printk (KERN_WARNING "Failed to find init proc to handle power off!\n" ); -printk ("%s|$(0x%x)%s\n" , severity, esp_code, desc); - } -read_unlock (&tasklist_lock); +envctrl_do_shutdown (); }else {/* print to system log */ printk ("%s|$(0x%x)%s\n" , severity, esp_code, desc);Index:
linux-2.6/drivers/sbus/char/bbc_envctrl.c
===================================================================drivers/sbus/char/bbc_envctrl.c +3
-6@@ -4,13 +4,12 @@* Copyright (C) 2001 David S. Miller ([email protected]) */ -#define __KERNEL_SYSCALLS__ -#include <linux/kernel.h> #include <linux/kthread.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/delay.h> +#include <linux/envctrl.h> #include <asm/oplib.h> #include <asm/ebus.h> static int errno;@@ -176,8 +175,6 @@static void do_envctrl_shutdown (struct bbc_cpu_temperature *tp) {static int shutting_down =0 ; -static char *envp[] = {"HOME=/" ,"TERM=linux" ,"PATH=/sbin:/usr/sbin:/bin:/usr/bin" ,NULL }; -char *argv[] = {"/sbin/shutdown" ,"-h" ,"now" ,NULL };char *type ="???" ;s8 val =-1 ;@@ -201,8 +198,8 @@printk (KERN_CRIT "kenvctrld: Shutting down the system now.\n" ); shutting_down =1 ; -if (execve ("/sbin/shutdown" , argv, envp) <0 ) -printk (KERN_CRIT "envctrl: shutdown execution failed\n" ); + +envctrl_do_shutdown (); }#define WARN_INTERVAL (30 * HZ)Index:
linux-2.6/drivers/sbus/char/envctrl.c
===================================================================drivers/sbus/char/envctrl.c +1
-21@@ -19,8 +19,6 @@* Daniele Bellucci <[email protected]> */ -#define __KERNEL_SYSCALLS__ -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> @@ -33,6 +31,7 @@#include <linux/mm.h> #include <linux/slab.h> #include <linux/kernel.h> +#include <linux/envctrl.h> #include <asm/ebus.h> #include <asm/uaccess.h> @@ -975,25 +974,6 @@return NULL ; } -static void envctrl_do_shutdown (void ) -{ -static int inprog =0 ; -static char *envp[] = { -"HOME=/" ,"TERM=linux" ,"PATH=/sbin:/usr/sbin:/bin:/usr/bin" ,NULL }; -char *argv[] = { -"/sbin/shutdown" ,"-h" ,"now" ,NULL }; - -if (inprog !=0 ) -return ; - - inprog =1 ; -printk (KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n" ); -if (0 >execve ("/sbin/shutdown" , argv, envp)) { -printk (KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n" ); - inprog =0 ;/* unlikely to succeed, but we could try again */ - } -} -static struct task_struct *kenvctrld_task;static int kenvctrld (void *__unused)Index:
linux-2.6/include/linux/envctrl.h
===================================================================include/linux/envctrl.h new file +6
-0@@ -0,0 +1,6 @@ +#ifndef _LINUX_ENVCTRL_H +#define _LINUX_ENVCTRL_H + +extern int envctrl_do_shutdown (void ); + +#endif /* _LINUX_ENVCTRL_H */ Index: linux-2.6/kernel/Makefile
===================================================================kernel/Makefile +1
-1@@ -7,7 +7,7 @@ sysctl.o capability.o ptrace.o timer.o user.o \ signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o intermodule.o extable.o params.o posix-timers.o \ - kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o + kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o envctrl.o obj-$(CONFIG_FUTEX) += futex.o obj-$(CONFIG_GENERIC_ISA_DMA) += dma.oIndex:
linux-2.6/kernel/envctrl.c
===================================================================kernel/envctrl.c new file +39
-0@@ -0,0 +1,46 @@ +/* +* Copyright (C) 2001 David S. Miller. +* Copyright (C) 2005 Christoph Hellwig. +* Released under GPL v2. +* +* Common code to shutdown the system when overheating. +*/ + +#include <linux/envctrl.h> +#include <linux/kernel.h> +#include <linux/kmod.h> + +static char *envp[] = { +"HOME=/" ,"TERM=linux" ,"PATH=/sbin:/usr/sbin:/bin:/usr/bin" ,NULL +}; + +static char *argv[] = { +"/sbin/shutdown" ,"-h" ,"now" ,NULL +}; + +/* +* envctrl_do_shutdown - shut the system down when overheating +* +* Common routine to be called from all enviromental monitoring +* drivers when a fatal overheating is detected. +* +* Returns 0 if /sbin/shutdown has been called sucessfully, 1 if +* this routine has been called already but the kernel is still +* running or a negative error value if executing the shutdown +* command failed. +*/ +int envctrl_do_shutdown (void ) +{ +static int shutting_down =0 ; +int error; + +if (shutting_down) +return 1 ; + shutting_down =1 ;
Quoted 9 lines
kernel/envctrl.c line 46
Quoted 7 lines
kernel/envctrl.c new file +7
-0+ +printk (KERN_CRIT "envctrl: WARNING: Shutting down the system now.\n" ); + error =call_usermodehelper ("/sbin/shutdown" , argv, envp,0 ); +if (error) +printk (KERN_CRIT "envctrl: WARNING: system shutdown failed!\n" ); +return error; +}---end quoted text---
--
Greg Howard, MTS - Core Platform SW MS 10-1-061 SGI - Silicon Graphics Inc. 2750 Blue Water Road [email protected] Eagan, MN 55121
+----------------------------------------------------------+
"Who am I to smudge the palette of conventional wisdom?"
- John Brocato
+----------------------------------------------------------+
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Currently
snsc_eventfor Altix systems sends SIGPWR to init (and abusestasklist_lock..) while the sbus drivers call execve for/sbin/shutdown(which is also ugly, it should at least usecall_usermodehelper) With normal sysvinit both will end up the same, but I suspect the shutdown variant, maybe with a sysctl to chose the exact path to call would be cleaner. What do you guys think about
sysctl is indeed would be nice. Paranoid users may insist on having freedom not to have /sbin at all.
Quoted 17 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
adding a common function to do this. Could you test such a patch for me?
Okay, here's such a patch, I've also switched the SN and the two sbus drivers over.
ping?
Hi Christoph,
Got your patch and built it into a kernel... Ran into other (unrelated) difficulties booting said kernel... I'll see if I can get that sorted out today and test drive it.
From inspection I don't see any problem with the patch.
Thanks - Greg
[snip]
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
kernel/envctrl.c new file +18
-0+/* +* envctrl_do_shutdown - shut the system down when overheating +* +* Common routine to be called from all enviromental monitoring +* drivers when a fatal overheating is detected. +* +* Returns 0 if /sbin/shutdown has been called sucessfully, 1 if +* this routine has been called already but the kernel is still +* running or a negative error value if executing the shutdown +* command failed. +*/ +int envctrl_do_shutdown (void ) +{ +static int shutting_down =0 ; +int error; + +if (shutting_down) +return 1 ;
Quoted 8 lines
Quoted 8 lines
kernel/envctrl.c line 46
Quoted 8 lines
kernel/envctrl.c new file +8
-0+ shutting_down =1 ; + +printk (KERN_CRIT "envctrl: WARNING: Shutting down the system now.\n" ); + error =call_usermodehelper ("/sbin/shutdown" , argv, envp,0 ); +if (error) +printk (KERN_CRIT "envctrl: WARNING: system shutdown failed!\n" ); +return error; +}
--
vda