From 2a34ee95f3929cff131db6c5a2b4820194c05b2d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 11 Sep 2000 07:02:43 +0000 Subject: the first cut of the internal messaging system. The motivation for this system is to replace the UDP message for oplocks, but this commit only does the "set debug level" message. --- source/lib/debug.c | 61 +++++++++++++++--------------------------------------- 1 file changed, 17 insertions(+), 44 deletions(-) (limited to 'source/lib/debug.c') diff --git a/source/lib/debug.c b/source/lib/debug.c index bfb638a38ac..5279dda2e35 100644 --- a/source/lib/debug.c +++ b/source/lib/debug.c @@ -119,51 +119,24 @@ static size_t format_pos = 0; * Functions... */ -#if defined(SIGUSR2) -/* ************************************************************************** ** - * catch a sigusr2 - decrease the debug log level. - * ************************************************************************** ** - */ -void sig_usr2( int sig ) - { - DEBUGLEVEL--; - if( DEBUGLEVEL < 0 ) - DEBUGLEVEL = 0; - - DEBUG( 0, ( "Got SIGUSR2; set debug level to %d.\n", DEBUGLEVEL ) ); - - sys_select_signal(); - -#if !defined(HAVE_SIGACTION) - CatchSignal( SIGUSR2, SIGNAL_CAST sig_usr2 ); -#endif - - } /* sig_usr2 */ -#endif /* SIGUSR2 */ - -#if defined(SIGUSR1) -/* ************************************************************************** ** - * catch a sigusr1 - increase the debug log level. - * ************************************************************************** ** - */ -void sig_usr1( int sig ) - { - - DEBUGLEVEL++; - - if( DEBUGLEVEL > 10 ) - DEBUGLEVEL = 10; - - DEBUG( 0, ( "Got SIGUSR1; set debug level to %d.\n", DEBUGLEVEL ) ); - - sys_select_signal(); - -#if !defined(HAVE_SIGACTION) - CatchSignal( SIGUSR1, SIGNAL_CAST sig_usr1 ); -#endif +/**************************************************************************** +receive a "set debug level" message +****************************************************************************/ +void debug_message(pid_t src, void *buf, int len) +{ + int level; + memcpy(&level, buf, sizeof(int)); + DEBUGLEVEL = level; + DEBUG(1,("Debug level set to %d from pid %d\n", level, (int)src)); +} - } /* sig_usr1 */ -#endif /* SIGUSR1 */ +/**************************************************************************** +send a "set debug level" message +****************************************************************************/ +void debug_message_send(pid_t pid, int level) +{ + message_send_pid(pid, MSG_DEBUG, &level, sizeof(int)); +} /* ************************************************************************** ** -- cgit