Re: [PATCH] perf tests: initialize sa.sa_flags

From: Peter Zijlstra
Date: Wed Mar 02 2016 - 08:21:35 EST


On Wed, Mar 02, 2016 at 10:03:50AM -0300, Arnaldo Carvalho de Melo wrote:
> > Would not something like:
> >
> > sa = (struct sigaction){
> > .sa_sigaction = segfault_handler,
> > };
> > sigfillset(&sa.sa_mask);
> >
> > Be better?
>
> I thought about that, but isn't that set in stone? This would be a 4
> liner, while his is a one' :-)

Dunno, you're right that its rather unlikely struct sigaction is going
to grow another member, but I like the above pattern better in general,
makes it harder to end up with uninitalized bits.

When performance matters the above pattern isn't ideal, but that should
not be a concern here.