summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-04-04 00:27:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:53 -0500
commit4fa555980070d78b39711ef21d77628d26055bc2 (patch)
tree38dd03bac5a57b45404f620ddf4eda2dd6ea06b0 /source3/nmbd
parentf5e7376bca7ab02ef48110ef6c0fb394851a606c (diff)
downloadsamba-4fa555980070d78b39711ef21d77628d26055bc2.tar.gz
samba-4fa555980070d78b39711ef21d77628d26055bc2.tar.bz2
samba-4fa555980070d78b39711ef21d77628d26055bc2.zip
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. (This used to be commit 56bc02d64498eb3faf89f0c5452b9299daea8e95)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index f58c389fc9..fca17d1ff7 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -106,46 +106,6 @@ static void sig_hup(int sig)
sys_select_signal(SIGHUP);
}
-#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_m(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 );
-}
-#endif
-
/**************************************************************************** **
Possibly continue after a fault.
**************************************************************************** */
@@ -692,6 +652,7 @@ static BOOL open_sockets(BOOL isdaemon, int port)
}
fault_setup((void (*)(void *))fault_continue );
+ dump_core_setup("nmbd");
/* POSIX demands that signals are inherited. If the invoking process has
* these signals masked, we will have problems, as we won't receive them. */