Message-ID: <52613A36.1060609@xenomai.org> Date: Fri, 18 Oct 2013 15:40:06 +0200 From: Philippe Gerum MIME-Version: 1.0 References: <52612F95.1080204@xenomai.org> <5261302C.6010709@xenomai.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] [PATCH 2 of 2] Xenomai-forge notifier_init: panic on failed pipe List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kim De Mey Cc: xenomai@xenomai.org On 10/18/2013 03:21 PM, Kim De Mey wrote: > > > > 2013/10/18 Philippe Gerum > > > On 10/18/2013 02:54 PM, Philippe Gerum wrote: > > On 10/18/2013 02:50 PM, Kim De Mey wrote: > > Panic if one of the pipe() system calls fails. To indicate > that there > is an underlying problem. > > Signed-off-by: Kim De Mey > > > --- > > lib/copperplate/notifier.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/copperplate/notifier.c > b/lib/copperplate/notifier.c > --- a/lib/copperplate/notifier.c > +++ b/lib/copperplate/notifier.c > @@ -144,12 +144,12 @@ int notifier_init(struct notifier *nf, > int fd; > > if (pipe(nf->psfd) < 0) > - return __bt(-errno); > + panic("failed to create file descriptors"); > > if (pipe(nf->pwfd) < 0) { > __STD(close(nf->psfd[0])); > __STD(close(nf->psfd[1])); > - return __bt(-errno); > + panic("failed to create file descriptors"); > } > > nf->callback = callback; > > > Nack. This routine returns a status code, the caller should > check it. > > > warning() would be acceptable though, for the same purpose, while > still propagating the error code instead of pulling the break > arbitrarily. > > > Agreed it would be much better if the caller checked it. But it is > currently not checked in threadobj_setup_corespec(). And as I am unsure > of what to do with it in that function I did this patch. > > Although a warning is probably enough indeed in case nothing is done > with the error in threadobj_setup_corespec(). > We can't rely on this assumption, since this may evolve, including for Mercury. This said, assert() on the status code of notifier_init() within that routine would make sense, so that it triggers in debug mode when the app starts. -- Philippe.