From: Ian Jackson Subject: Re: [PATCH 23/24] libxl: child processes cleanups Date: Tue, 24 Apr 2012 16:22:50 +0100 Message-ID: <20374.50506.869984.497578@mariner.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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1335276732.4347.155.camel@zakaz.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 Campbell Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org 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. Ian.