From: Ian Campbell Subject: Re: [PATCH 23/24] libxl: child processes cleanups Date: Tue, 24 Apr 2012 16:32:52 +0100 Message-ID: <1335281572.4347.214.camel@zakaz.uk.xensource.com> References: <1334596686-8479-1-git-send-email-ian.jackson@eu.citrix.com> <1334596686-8479-24-git-send-email-ian.jackson@eu.citrix.com> <1335276732.4347.155.camel@zakaz.uk.xensource.com> <20374.50506.869984.497578@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20374.50506.869984.497578@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Tue, 2012-04-24 at 16:22 +0100, Ian Jackson wrote: > Ian Campbell writes ("Re: [Xen-devel] [PATCH 23/24] libxl: child processes cleanups"): > > On Mon, 2012-04-16 at 18:18 +0100, Ian Jackson wrote: > > > - child = fork(); > > > + pid_t (*fork_replacement)(void*) = > > > + CTX->childproc_hooks > > > + ? CTX->childproc_hooks->fork_replacement > > > + : 0; > > > + child = > > > + fork_replacement > > > + ? fork_replacement(CTX->childproc_user) > > > + : fork(); > > > > A helper function or macro would be useful here? > > There is exactly one call site for this, since no-one else in libxl is > allowed to call fork (except libxl__spawn_*, in the child as > previously discussed, and there it doesn't want to use the hook). > If you think it would be clearer I'm happy to make it into a > sub-function. But IMO libxl__ev_child_fork is already quite short so > I don't see much point further splitting it up. I guess I was just a bit slow on the parse of these two statements which made me think a function might have a name which helped me, but your explanation about it being the only possible callsite makes sense so I think you can leave it as is. Ian.