diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-09-11 07:02:43 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-09-11 07:02:43 +0000 |
commit | 2a34ee95f3929cff131db6c5a2b4820194c05b2d (patch) | |
tree | fecc764ce6abab264d18b9ee9f4028f2c2253a25 /source/lib/debug.c | |
parent | fb48efaf830626f6ef05b88f5f8a74b932ceb257 (diff) | |
download | samba-2a34ee95f3929cff131db6c5a2b4820194c05b2d.tar.gz samba-2a34ee95f3929cff131db6c5a2b4820194c05b2d.tar.xz samba-2a34ee95f3929cff131db6c5a2b4820194c05b2d.zip |
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.
Diffstat (limited to 'source/lib/debug.c')
-rw-r--r-- | source/lib/debug.c | 61 |
1 files changed, 17 insertions, 44 deletions
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)); +} /* ************************************************************************** ** |