#ifdef CONFIG_KEXEC case LINUX_REBOOT_CMD_KEXEC: { struct kimage *image; image = xchg(&kexec_image, 0); if (!image) { unlock_kernel(); return -EINVAL; } notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL); system_state = SYSTEM_RESTART; device_shutdown(); printk(KERN_EMERG "Starting new kernel\n"); machine_shutdown(); machine_kexec(image); break; } #endif 
asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user * arg){	char buffer[256];	/* We only trust the superuser with rebooting the system. */	if (!capable(CAP_SYS_BOOT))		return -EPERM;	/* For safety, we require "magic" arguments. */	if (magic1 != LINUX_REBOOT_MAGIC1 ||	    (magic2 != LINUX_REBOOT_MAGIC2 &&	                magic2 != LINUX_REBOOT_MAGIC2A &&			magic2 != LINUX_REBOOT_MAGIC2B &&	                magic2 != LINUX_REBOOT_MAGIC2C))		return -EINVAL;	lock_kernel();	switch (cmd) {	case LINUX_REBOOT_CMD_RESTART:		notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);		system_state = SYSTEM_RESTART;		device_shutdown();		printk(KERN_EMERG "Restarting system.\n");		machine_restart(NULL);		break;	case LINUX_REBOOT_CMD_CAD_ON:		C_A_D = 1;		break;	case LINUX_REBOOT_CMD_CAD_OFF:		C_A_D = 0;		break;	case LINUX_REBOOT_CMD_HALT:		notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);		system_state = SYSTEM_HALT;		device_suspend(PMSG_SUSPEND);		device_shutdown();		printk(KERN_EMERG "System halted.\n");		machine_halt();		unlock_kernel();		do_exit(0);		break;	case LINUX_REBOOT_CMD_POWER_OFF:		notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);		system_state = SYSTEM_POWER_OFF;		device_suspend(PMSG_SUSPEND);		device_shutdown();		printk(KERN_EMERG "Power down.\n");		machine_power_off();		unlock_kernel();		do_exit(0);		break;	case LINUX_REBOOT_CMD_RESTART2:		if (strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1) < 0) {			unlock_kernel();			return -EFAULT;		}		buffer[sizeof(buffer) - 1] = '\0';		notifier_call_chain(&reboot_notifier_list, SYS_RESTART, buffer);		system_state = SYSTEM_RESTART;		device_suspend(PMSG_FREEZE);		device_shutdown();		printk(KERN_EMERG "Restarting system with command '%s'.\n", buffer);		machine_restart(buffer);		break;#ifdef CONFIG_SOFTWARE_SUSPEND	case LINUX_REBOOT_CMD_SW_SUSPEND:		{			int ret = software_suspend();			unlock_kernel();			return ret;		}#endif	default:		unlock_kernel();		return -EINVAL;	}	unlock_kernel();	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/dc009d92435f99498cbc579ce76bf28e837e2c14/sys.c/clean/kernel/sys.c