From aef2c5d69956c72f8b0bd2285283e8879ed8603d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 24 Dec 1997 09:30:56 +0000 Subject: Added SIGUSR1/SIGUSR2 handling. Sending nmbd/smbd a SIGUSR1 will raise the debug level by one (capped at 10) sending a SIGUSR2 will lower it (lower limit at zero). Jeremy. (This used to be commit 6a3cb6f4b46129e4d799a24d34cdb9460ed8910f) --- source3/lib/util.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 125db2ed1e..5c81a14c66 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -92,6 +92,53 @@ static BOOL stdout_logging = False; static char *filename_dos(char *path,char *buf); +#if defined(SIGUSR2) +/**************************************************************************** ** + catch a sigusr2 - decrease the debug log level. + **************************************************************************** */ +int sig_usr2(void) +{ + BlockSignals( True, SIGUSR2); + + DEBUGLEVEL--; + + if(DEBUGLEVEL < 0) + DEBUGLEVEL = 0; + + DEBUG( 0, ( "Got SIGUSR2 set debug level to %d.\n", DEBUGLEVEL ) ); + + BlockSignals( False, SIGUSR2); +#ifndef DONT_REINSTALL_SIG + signal(SIGUSR2, SIGNAL_CAST sig_usr2); +#endif + return(0); +} +#endif /* SIGUSR1 */ + +#if defined(SIGUSR1) +/**************************************************************************** ** + catch a sigusr1 - increase the debug log level. + **************************************************************************** */ +int sig_usr1(void) +{ + BlockSignals( True, SIGUSR1); + + DEBUGLEVEL++; + + if(DEBUGLEVEL > 10) + DEBUGLEVEL = 10; + + DEBUG( 0, ( "Got SIGUSR1 set debug level to %d.\n", DEBUGLEVEL ) ); + + BlockSignals( False, SIGUSR1); +#ifndef DONT_REINSTALL_SIG + signal(SIGUSR1, SIGNAL_CAST sig_usr1); +#endif + return(0); +} +#endif /* SIGUSR1 */ + + /******************************************************************* get ready for syslog stuff ******************************************************************/ -- cgit