From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] xenconsole: Allow non-interactive use Date: Fri, 24 Jul 2015 12:44:22 +0100 Message-ID: <1437738262.24746.79.camel@citrix.com> References: <1437584888-9074-1-git-send-email-martin@lucina.net> <1437641330.19412.37.camel@citrix.com> <20150723150915.GA23015@nodbug.lucina.net> <1437664991.24746.10.camel@citrix.com> <20150724113612.GC25338@nodbug.lucina.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZIbOu-0006ei-DD for xen-devel@lists.xenproject.org; Fri, 24 Jul 2015 11:44:28 +0000 In-Reply-To: <20150724113612.GC25338@nodbug.lucina.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Martin Lucina Cc: xen-devel@lists.xenproject.org, Wei Liu , Ian Jackson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, 2015-07-24 at 13:36 +0200, Martin Lucina wrote: > On Thursday, 23.07.2015 at 16:23, Ian Campbell wrote: > > On Thu, 2015-07-23 at 17:09 +0200, Martin Lucina wrote: > > > > > > But maybe it would be better to set max_fd = -1 on declaration > > > > and > > > > do > > > > the max dance here as with the following cases? > > > > > > Declaring max_fd = -1 is indeed clearer, I can do a v2 with that > > > change if you like. > > > > If you are happy to then yes, please. > > > > > One other bug that my change makes potentially easier to trigger > > > is that > > > you can run "xl console DOMID" multiple times with the same DOMID > > > and the > > > result is broken; each instance gets part of the data written to > > > the > > > console. > > > > > > Any ideas on how to address this in a simple fashion? > > > > Perhaps the client should take some exclusive lock (fcntl based?) > > on an > > fd of an open file with domid in the name. Failure to get the lock > > should result in the client exiting with some message indicating > > the > > console is in use. > > That begs the question of where to put the lock file. eg. NetBSD does > not > seem to have /var/lock. Configure ends up defining XEN_LOCK_DIR, so it should go in there alongside the other locks. > I tried using flock(pty_fd, LOCK_EX | LOCK_NB) locks directly on the pty > device and contrary to the documentation claiming support for regular files > only it worked fine. I tested using the xenconsole code on my Debian dom0, > and flock(1) on NetBSD. Would you consider this approach? Only if that functionality was required by POSIX IMHO. Ian.