diff options
author | James Peach <jpeach@samba.org> | 2006-04-04 00:27:50 +0000 |
---|---|---|
committer | James Peach <jpeach@samba.org> | 2006-04-04 00:27:50 +0000 |
commit | a8e120f5a7316d03fdea921923e7e2fce24b8538 (patch) | |
tree | fefdf1b8633b86308d637cc351e66f6c7ed8df53 /source/nsswitch/winbindd.c | |
parent | ea035fdad1dc752b58e3b597244bf269476aa6b7 (diff) | |
download | samba-a8e120f5a7316d03fdea921923e7e2fce24b8538.tar.gz |
r14898: This change is an attempt to improve the quality of the information that
is produced when a process exits abnormally.
First, we coalesce the core dumping code so that we greatly improve our
odds of being able to produce a core file, even in the case of a memory
fault. I've removed duplicates of dump_core() and split it in two to
reduce the amount of work needed to actually do the dump.
Second, we refactor the exit_server code path to always log an explanation
and a stack trace. My goal is to always produce enough log information
for us to be able to explain any server exit, though there is a risk
that this could produce too much log information on a flaky network.
Finally, smbcontrol has gained a smbd fault injection operation to test
the changes above. This is only enabled for developer builds.
Diffstat (limited to 'source/nsswitch/winbindd.c')
-rw-r--r-- | source/nsswitch/winbindd.c | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/source/nsswitch/winbindd.c b/source/nsswitch/winbindd.c index ad2774eea6e..b3184162729 100644 --- a/source/nsswitch/winbindd.c +++ b/source/nsswitch/winbindd.c @@ -56,46 +56,6 @@ static BOOL reload_services_file(void) } -#if DUMP_CORE - -/**************************************************************************** ** - Prepare to dump a core file - carefully! - **************************************************************************** */ - -static BOOL dump_core(void) -{ - char *p; - pstring dname; - pstrcpy( dname, lp_logfile() ); - if ((p=strrchr(dname,'/'))) - *p=0; - pstrcat( dname, "/corefiles" ); - mkdir( dname, 0700 ); - sys_chown( dname, getuid(), getgid() ); - chmod( dname, 0700 ); - if ( chdir(dname) ) - return( False ); - umask( ~(0700) ); - -#ifdef HAVE_GETRLIMIT -#ifdef RLIMIT_CORE - { - struct rlimit rlp; - getrlimit( RLIMIT_CORE, &rlp ); - rlp.rlim_cur = MAX( 4*1024*1024, rlp.rlim_cur ); - setrlimit( RLIMIT_CORE, &rlp ); - getrlimit( RLIMIT_CORE, &rlp ); - DEBUG( 3, ( "Core limits now %d %d\n", (int)rlp.rlim_cur, (int)rlp.rlim_max ) ); - } -#endif -#endif - - DEBUG(0,("Dumping core in %s\n",dname)); - abort(); - return( True ); -} /* dump_core */ -#endif - /**************************************************************************** ** Handle a fault.. **************************************************************************** */ @@ -933,6 +893,7 @@ int main(int argc, char **argv) CatchSignal(SIGUSR2, SIG_IGN); fault_setup((void (*)(void *))fault_quit ); + dump_core_setup("winbindd"); load_case_tables(); |