From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: Re: [PATCH 18/31] libxl: Protect fds with CLOEXEC even with forking threads Date: Wed, 11 Apr 2012 11:38:01 +0100 Message-ID: <20357.24329.215011.7201@mariner.uk.xensource.com> References: <1334084885-14474-1-git-send-email-ian.jackson@eu.citrix.com> <1334084885-14474-19-git-send-email-ian.jackson@eu.citrix.com> <1334135691.5394.85.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: <1334135691.5394.85.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 18/31] libxl: Protect fds with CLOEXEC even with forking threads"): > On Tue, 2012-04-10 at 20:07 +0100, Ian Jackson wrote: > > + r = pthread_atfork(atfork_lock, atfork_unlock, atfork_unlock); > > + if (r) libxl__alloc_failed(ctx, __func__, 0,0); > > This is a bit subtle -- the only documented error from pthread_atfork is > ENOMEM. Perhaps "assert(r == 0 || errno == ENOMEM)" as both > belt'n'braces and doc? Sure. I have done this: r = pthread_atfork(atfork_lock, atfork_unlock, atfork_unlock); if (r) { assert(r == ENOMEM); libxl__alloc_failed(ctx, __func__, 0,0); } > The above wouldn't stop me from acking though: > > Acked-by: Ian Campbell Thanks, Ian.