From: Ian Jackson Subject: Re: c/s 17731 portability issues Date: Tue, 27 May 2008 11:33:27 +0100 Message-ID: <18491.58231.794506.278332@mariner.uk.xensource.com> References: <200805261007.00725.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: Christoph Egger , xen-devel@lists.xensource.com, Xiaowei Hu , john.levon@sun.com List-Id: xen-devel@lists.xenproject.org Keir Fraser writes ("Re: [Xen-devel] c/s 17731 portability issues"): > On 26/5/08 09:07, "Christoph Egger" wrote: > > BSD ps has no --no-headers argument. > > Solaris ps has no --no-headers argument and -o has a different > > semantic. > > Then the surrounding logic would need to be fixed up too. I wonder whether > it is even possible to extract process state from ps in an OS-neutral way? Certainly running ps in this way is not the right way to do it. At the time of the qemu-dm crash, surely there are two possible situations: * xend has not been restarted since this domain started. xend is therefore the parent process of qemu-dm and should be able to get the process status via wait[pid]. * xend _has_ been restarted. In this case reliable failure detection is not possible but at the very least `kill(, 0)' can be used to detect whether some process with that pid is still present. If it isn't then we know it has crashed; if it is then perhaps it is still running or perhaps the pid has been reused. If you want a more reliable arrangement, we need a new daemon to be the parent of qemu-dm, or for qemu-dm to acquire some resource which the kernel will automatically clean up when it dies. Obvious candidates for the latter are a descriptor onto a named pipe or a fcntl file lock. Both of the latter should be possible for xend to set up as qemu-dm's precedessor-in-exec, without needing changes to qemu-dm itself. Ian.