aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-03-22 16:48:00 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-03-22 16:48:00 +0100
commit0be2ec9f9e91a1eaa8912831acb83dc82f6f4db0 (patch)
tree6698ad79abb214938827871d626e9a238c583f09
parent316d5899a086b1acb3765c1dab661732a9fee14c (diff)
downloadxen-0be2ec9f9e91a1eaa8912831acb83dc82f6f4db0.tar.gz
xen-0be2ec9f9e91a1eaa8912831acb83dc82f6f4db0.tar.bz2
xen-0be2ec9f9e91a1eaa8912831acb83dc82f6f4db0.zip
Externally triggered reboot signal executes ctrl_alt_del()
rather than calling /sbin/reboot directly. Signed-off-by: Keir Fraser <keir@xensource.com>
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/core/reboot.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c
index 4ed9b2de3e..e63e40465d 100644
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c
@@ -25,9 +25,10 @@ void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);
#endif
+extern void ctrl_alt_del(void);
+
#define SHUTDOWN_INVALID -1
#define SHUTDOWN_POWEROFF 0
-#define SHUTDOWN_REBOOT 1
#define SHUTDOWN_SUSPEND 2
/* Code 3 is SHUTDOWN_CRASH, which we don't use because the domain can only
* report a crash, not be instructed to crash!
@@ -234,33 +235,19 @@ static int shutdown_process(void *__unused)
{
static char *envp[] = { "HOME=/", "TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
- static char *restart_argv[] = { "/sbin/reboot", NULL };
static char *poweroff_argv[] = { "/sbin/poweroff", NULL };
extern asmlinkage long sys_reboot(int magic1, int magic2,
unsigned int cmd, void *arg);
- daemonize("shutdown");
-
- switch (shutting_down) {
- case SHUTDOWN_POWEROFF:
- case SHUTDOWN_HALT:
+ if ((shutting_down == SHUTDOWN_POWEROFF) ||
+ (shutting_down == SHUTDOWN_HALT)) {
if (execve("/sbin/poweroff", poweroff_argv, envp) < 0) {
sys_reboot(LINUX_REBOOT_MAGIC1,
LINUX_REBOOT_MAGIC2,
LINUX_REBOOT_CMD_POWER_OFF,
NULL);
}
- break;
-
- case SHUTDOWN_REBOOT:
- if (execve("/sbin/reboot", restart_argv, envp) < 0) {
- sys_reboot(LINUX_REBOOT_MAGIC1,
- LINUX_REBOOT_MAGIC2,
- LINUX_REBOOT_CMD_RESTART,
- NULL);
- }
- break;
}
shutting_down = SHUTDOWN_INVALID; /* could try again */
@@ -331,7 +318,7 @@ static void shutdown_handler(struct xenbus_watch *watch,
if (strcmp(str, "poweroff") == 0)
shutting_down = SHUTDOWN_POWEROFF;
else if (strcmp(str, "reboot") == 0)
- shutting_down = SHUTDOWN_REBOOT;
+ ctrl_alt_del();
else if (strcmp(str, "suspend") == 0)
shutting_down = SHUTDOWN_SUSPEND;
else if (strcmp(str, "halt") == 0)
@@ -391,8 +378,6 @@ static struct xenbus_watch sysrq_watch = {
};
#endif
-static struct notifier_block xenstore_notifier;
-
static int setup_shutdown_watcher(struct notifier_block *notifier,
unsigned long event,
void *data)
@@ -420,11 +405,10 @@ static int setup_shutdown_watcher(struct notifier_block *notifier,
static int __init setup_shutdown_event(void)
{
-
- xenstore_notifier.notifier_call = setup_shutdown_watcher;
-
+ static struct notifier_block xenstore_notifier = {
+ .notifier_call = setup_shutdown_watcher
+ };
register_xenstore_notifier(&xenstore_notifier);
-
return 0;
}