summaryrefslogtreecommitdiff
path: root/source3/lib/debug.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-09-11 07:02:43 +0000
committerAndrew Tridgell <tridge@samba.org>2000-09-11 07:02:43 +0000
commit3689e4ffc10fceb4c39814ef58fe31697e7dd976 (patch)
tree805fc5690a3b97e4e72866519760ee86a038c781 /source3/lib/debug.c
parente0f9de0c49dde82610b0da406b4685e787f69725 (diff)
downloadsamba-3689e4ffc10fceb4c39814ef58fe31697e7dd976.tar.gz
samba-3689e4ffc10fceb4c39814ef58fe31697e7dd976.tar.bz2
samba-3689e4ffc10fceb4c39814ef58fe31697e7dd976.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. (This used to be commit 2a34ee95f3929cff131db6c5a2b4820194c05b2d)
Diffstat (limited to 'source3/lib/debug.c')
-rw-r--r--source3/lib/debug.c61
1 files changed, 17 insertions, 44 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index bfb638a38a..5279dda2e3 100644
--- a/source3/lib/debug.c
+++ b/source3/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));
+}
/* ************************************************************************** **