From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751120AbVLNROk (ORCPT ); Wed, 14 Dec 2005 12:14:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751261AbVLNROk (ORCPT ); Wed, 14 Dec 2005 12:14:40 -0500 Received: from ebiederm.dsl.xmission.com ([166.70.28.69]:9145 "EHLO ebiederm.dsl.xmission.com") by vger.kernel.org with ESMTP id S1751120AbVLNROj (ORCPT ); Wed, 14 Dec 2005 12:14:39 -0500 To: Pavel Machek Cc: Andrew Morton , Zwane Mwaikambo , "Raj, Ashok" , Andi Kleen , Dave Jones , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Don't attempt to power off if power off is not implemented. References: <19700102031329.GA2372@ucw.cz> From: ebiederm@xmission.com (Eric W. Biederman) Date: Wed, 14 Dec 2005 10:12:41 -0700 In-Reply-To: <19700102031329.GA2372@ucw.cz> (Pavel Machek's message of "Fri, 2 Jan 1970 03:13:29 +0000") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Pavel Machek writes: > Hi! > >> diff --git a/kernel/sys.c b/kernel/sys.c >> index bce933e..bf5842f 100644 >> --- a/kernel/sys.c >> +++ b/kernel/sys.c >> @@ -488,6 +488,12 @@ asmlinkage long sys_reboot(int magic1, i >> magic2 != LINUX_REBOOT_MAGIC2C)) >> return -EINVAL; >> >> + /* Instead of trying to make the power_off code look like >> + * halt when pm_power_off is not set do it the easy way. >> + */ >> + if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off) >> + cmd = LINUX_REBOOT_CMD_HALT; >> + >> lock_kernel(); >> switch (cmd) { >> case LINUX_REBOOT_CMD_RESTART: > > Would not it be better to return -EPERM here or something like that? > That way userspace can decide that it really wants reboot or something > else. Because that would change the current semantics of what LINUX_REBOOT_CMD_POWER_OFF. It is painful enough getting the infrastructure change through without the having to worry about breaking userspace as well. Despite what it may look like this is purely to fix bugs in the implementation. If I was going to hack user space the quick fix is to remove the -p flag passed to /sbin/halt in the reboot scripts. Eric