[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Externally triggered reboot signal executes ctrl_alt_del()



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 787b39f5fc83d8b599b0d8c824eccea00f9367f0
# Parent  4080ec91a0144dfc11a7e8feddd2274a57fd43fb
Externally triggered reboot signal executes ctrl_alt_del()
rather than calling /sbin/reboot directly.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 4080ec91a014 -r 787b39f5fc83 
linux-2.6-xen-sparse/drivers/xen/core/reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Wed Mar 22 15:47:18 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Wed Mar 22 15:48:00 2006
@@ -25,9 +25,10 @@
 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 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 @@
        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 @@
 };
 #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 __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;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.