[PATCH] Fix bug 11175 - Lots of winbindd zombie processes on Solaris platform

Lukas Slebodnik lslebodn at redhat.com
Tue Mar 24 16:22:31 MDT 2015


On (23/03/15 14:29), Jeremy Allison wrote:
>On Mon, Mar 23, 2015 at 10:24:36PM +0100, Volker Lendecke wrote:
>> On Mon, Mar 23, 2015 at 02:09:35PM -0700, Jeremy Allison wrote:
>> >  
>> > +static void (*tdb_robust_mutex_setup_sigchild(void (*handler)(int)))(int)
>>                ^                                                      ^
>> 
>> Is this set of braces really necessary?
>
>Compiler says yes :-).
>
>> > -	signal(SIGCHLD, tdb_robust_mutext_old_handler);
>> > +	(void)tdb_robust_mutex_setup_sigchild(tdb_robust_mutext_old_handler);
>> 
>> And this (void)? Is that necessary?
>
>Compiler says no, so no :-).
>
>> >  cleanup_sig_child:
>> > -	signal(SIGCHLD, tdb_robust_mutext_old_handler);
>> > +	(void)tdb_robust_mutex_setup_sigchild(tdb_robust_mutext_old_handler);
>> 
>> Here too.
>
>As above..
>
>Updated version attached...

>From 87ea8b98d5c2bc4a9ecb5951fb5ef06831fc1b99 Mon Sep 17 00:00:00 2001
>From: Jeremy Allison <jra at samba.org>
>Date: Fri, 20 Mar 2015 10:59:08 -0700
>Subject: [PATCH] lib: tdb: Use sigaction when testing for robust mutexes.
>
>Fixes bug #11175 - Lots of winbindd zombie processes on Solaris platform.
>
>https://bugzilla.samba.org/show_bug.cgi?id=11175
>
>Signed-off-by: Jeremy Allison <jra at samba.org>
>---
> lib/tdb/common/mutex.c | 32 ++++++++++++++++++++++++++++----
> 1 file changed, 28 insertions(+), 4 deletions(-)
>
>diff --git a/lib/tdb/common/mutex.c b/lib/tdb/common/mutex.c
>index 12f89d3..3700903 100644
>--- a/lib/tdb/common/mutex.c
>+++ b/lib/tdb/common/mutex.c
>@@ -713,6 +713,27 @@ cleanup_ma:
> static void (*tdb_robust_mutext_old_handler)(int) = SIG_ERR;
> static pid_t tdb_robust_mutex_pid = -1;
> 
>+static void (*tdb_robust_mutex_setup_sigchild(void (*handler)(int)))(int)
>+{
I checked manual pages on Linux an FreeBSD
and there is a nicer way with using typedef.

man 2 signal (Linux):
SYNOPSIS
       #include <signal.h>

       typedef void (*sighandler_t)(int);

       sighandler_t signal(int signum, sighandler_t handler);

man 3 signal (FreeBSD)
SYNOPSIS
     #include <signal.h>

     void (*signal(int sig, void (*func)(int)))(int);

     or in FreeBSD's equivalent but easier to read typedef'd version:

     typedef void (*sig_t) (int);

     sig_t
     signal(int sig, sig_t func);

It's much nicer and easier to read version with typedef.

BTW: The very good explanation is on page
http://c-faq.com/decl/spiral.anderson.html

HTH

LS


More information about the samba-technical mailing list