From eaa085e8a7106d595235b36d1592ca38b47ba53f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 13 Jun 1999 04:01:08 +0000 Subject: Hived off debugging code from smb.h and put into debug.h (This used to be commit afe5be3cf62b90100861e2433ea885f5d6f8708c) --- source3/include/debug.h | 121 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 source3/include/debug.h (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h new file mode 100644 index 0000000000..df74da0b41 --- /dev/null +++ b/source3/include/debug.h @@ -0,0 +1,121 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + SMB debug stuff + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) John H Terpstra 1996-1998 + Copyright (C) Luke Kenneth Casson Leighton 1996-1998 + Copyright (C) Paul Ashton 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _DEBUG_H +#define _DEBUG_H + +/* -------------------------------------------------------------------------- ** + * Debugging code. See also debug.c + */ + +/* mkproto.awk has trouble with ifdef'd function definitions (it ignores + * the #ifdef directive and will read both definitions, thus creating two + * diffferent prototype declarations), so we must do these by hand. + */ +/* I know the __attribute__ stuff is ugly, but it does ensure we get the + arguemnts to DEBUG() right. We have got them wrong too often in the + past. + */ +#ifdef HAVE_STDARG_H +int Debug1( char *, ... ) +#ifdef __GNUC__ + __attribute__ ((format (printf, 1, 2))) +#endif +; +BOOL dbgtext( char *, ... ) +#ifdef __GNUC__ + __attribute__ ((format (printf, 1, 2))) +#endif +; +#else +int Debug1(); +BOOL dbgtext(); +#endif + +/* If we have these macros, we can add additional info to the header. */ +#ifdef HAVE_FILE_MACRO +#define FILE_MACRO (__FILE__) +#else +#define FILE_MACRO ("") +#endif + +#ifdef HAVE_FUNCTION_MACRO +#define FUNCTION_MACRO (__FUNCTION__) +#else +#define FUNCTION_MACRO ("") +#endif + +/* Debugging macros. + * DEBUGLVL() - If level is <= the system-wide DEBUGLEVEL then generate a + * header using the default macros for file, line, and + * function name. + * Returns True if the debug level was <= DEBUGLEVEL. + * Example usage: + * if( DEBUGLVL( 2 ) ) + * dbgtext( "Some text.\n" ); + * DEGUG() - Good old DEBUG(). Each call to DEBUG() will generate a new + * header *unless* the previous debug output was unterminated + * (i.e., no '\n'). See debug.c:dbghdr() for more info. + * Example usage: + * DEBUG( 2, ("Some text.\n") ); + * DEBUGADD() - If level <= DEBUGLEVEL, then the text is appended to the + * current message (i.e., no header). + * Usage: + * DEBUGADD( 2, ("Some additional text.\n") ); + */ +#define DEBUGLVL( level ) \ + ( (DEBUGLEVEL >= (level)) \ + && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) + +#define DEBUG( level, body ) \ + (void)( (DEBUGLEVEL >= (level)) \ + && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ + && (dbgtext body) ) + +#define DEBUGADD( level, body ) \ + (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) ) + +/* -------------------------------------------------------------------------- ** + * These are the tokens returned by dbg_char2token(). + */ + +typedef enum + { + dbg_null = 0, + dbg_ignore, + dbg_header, + dbg_timestamp, + dbg_level, + dbg_sourcefile, + dbg_function, + dbg_lineno, + dbg_message, + dbg_eof + } dbg_Token; + +/* End Debugging code section. + * -------------------------------------------------------------------------- ** + */ + +#endif -- cgit From 32a965e09ce4befe971855e11e1fb5ceb51a9ed1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:35:20 +0000 Subject: 2nd phase of head branch sync with SAMBA_2_0 - this delets all the files that were in the head branch but weren't in SAMBA_2_0 (This used to be commit d7b208786590b5a28618590172b8d523627dda09) --- source3/include/debug.h | 121 ------------------------------------------------ 1 file changed, 121 deletions(-) delete mode 100644 source3/include/debug.h (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h deleted file mode 100644 index df74da0b41..0000000000 --- a/source3/include/debug.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - SMB debug stuff - Copyright (C) Andrew Tridgell 1992-1998 - Copyright (C) John H Terpstra 1996-1998 - Copyright (C) Luke Kenneth Casson Leighton 1996-1998 - Copyright (C) Paul Ashton 1998 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _DEBUG_H -#define _DEBUG_H - -/* -------------------------------------------------------------------------- ** - * Debugging code. See also debug.c - */ - -/* mkproto.awk has trouble with ifdef'd function definitions (it ignores - * the #ifdef directive and will read both definitions, thus creating two - * diffferent prototype declarations), so we must do these by hand. - */ -/* I know the __attribute__ stuff is ugly, but it does ensure we get the - arguemnts to DEBUG() right. We have got them wrong too often in the - past. - */ -#ifdef HAVE_STDARG_H -int Debug1( char *, ... ) -#ifdef __GNUC__ - __attribute__ ((format (printf, 1, 2))) -#endif -; -BOOL dbgtext( char *, ... ) -#ifdef __GNUC__ - __attribute__ ((format (printf, 1, 2))) -#endif -; -#else -int Debug1(); -BOOL dbgtext(); -#endif - -/* If we have these macros, we can add additional info to the header. */ -#ifdef HAVE_FILE_MACRO -#define FILE_MACRO (__FILE__) -#else -#define FILE_MACRO ("") -#endif - -#ifdef HAVE_FUNCTION_MACRO -#define FUNCTION_MACRO (__FUNCTION__) -#else -#define FUNCTION_MACRO ("") -#endif - -/* Debugging macros. - * DEBUGLVL() - If level is <= the system-wide DEBUGLEVEL then generate a - * header using the default macros for file, line, and - * function name. - * Returns True if the debug level was <= DEBUGLEVEL. - * Example usage: - * if( DEBUGLVL( 2 ) ) - * dbgtext( "Some text.\n" ); - * DEGUG() - Good old DEBUG(). Each call to DEBUG() will generate a new - * header *unless* the previous debug output was unterminated - * (i.e., no '\n'). See debug.c:dbghdr() for more info. - * Example usage: - * DEBUG( 2, ("Some text.\n") ); - * DEBUGADD() - If level <= DEBUGLEVEL, then the text is appended to the - * current message (i.e., no header). - * Usage: - * DEBUGADD( 2, ("Some additional text.\n") ); - */ -#define DEBUGLVL( level ) \ - ( (DEBUGLEVEL >= (level)) \ - && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) - -#define DEBUG( level, body ) \ - (void)( (DEBUGLEVEL >= (level)) \ - && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ - && (dbgtext body) ) - -#define DEBUGADD( level, body ) \ - (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) ) - -/* -------------------------------------------------------------------------- ** - * These are the tokens returned by dbg_char2token(). - */ - -typedef enum - { - dbg_null = 0, - dbg_ignore, - dbg_header, - dbg_timestamp, - dbg_level, - dbg_sourcefile, - dbg_function, - dbg_lineno, - dbg_message, - dbg_eof - } dbg_Token; - -/* End Debugging code section. - * -------------------------------------------------------------------------- ** - */ - -#endif -- cgit From 04f7d80ac358520c0d6e351f790f59208853130a Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 3 Feb 2000 04:47:50 +0000 Subject: Busting up of source/include/smb.h into smaller pieces which can be #included by VFS modules without bringing in too much other junk. (This used to be commit 13a2cf80f65156e725a5716e62a4c44e70f5340f) --- source3/include/debug.h | 103 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 source3/include/debug.h (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h new file mode 100644 index 0000000000..c6ddf61525 --- /dev/null +++ b/source3/include/debug.h @@ -0,0 +1,103 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + SMB debug stuff + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) John H Terpstra 1996-1998 + Copyright (C) Luke Kenneth Casson Leighton 1996-1998 + Copyright (C) Paul Ashton 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _DEBUG_H +#define _DEBUG_H + +/* -------------------------------------------------------------------------- ** + * Debugging code. See also debug.c + */ + +/* mkproto.awk has trouble with ifdef'd function definitions (it ignores + * the #ifdef directive and will read both definitions, thus creating two + * diffferent prototype declarations), so we must do these by hand. + */ +/* I know the __attribute__ stuff is ugly, but it does ensure we get the + arguemnts to DEBUG() right. We have got them wrong too often in the + past. + */ +#ifdef HAVE_STDARG_H +int Debug1( char *, ... ) +#ifdef __GNUC__ + __attribute__ ((format (printf, 1, 2))) +#endif +; +BOOL dbgtext( char *, ... ) +#ifdef __GNUC__ + __attribute__ ((format (printf, 1, 2))) +#endif +; +#else +int Debug1(); +BOOL dbgtext(); +#endif + +/* If we have these macros, we can add additional info to the header. */ +#ifdef HAVE_FILE_MACRO +#define FILE_MACRO (__FILE__) +#else +#define FILE_MACRO ("") +#endif + +#ifdef HAVE_FUNCTION_MACRO +#define FUNCTION_MACRO (__FUNCTION__) +#else +#define FUNCTION_MACRO ("") +#endif + +/* Debugging macros. + * DEBUGLVL() - If level is <= the system-wide DEBUGLEVEL then generate a + * header using the default macros for file, line, and + * function name. + * Returns True if the debug level was <= DEBUGLEVEL. + * Example usage: + * if( DEBUGLVL( 2 ) ) + * dbgtext( "Some text.\n" ); + * DEGUG() - Good old DEBUG(). Each call to DEBUG() will generate a new + * header *unless* the previous debug output was unterminated + * (i.e., no '\n'). See debug.c:dbghdr() for more info. + * Example usage: + * DEBUG( 2, ("Some text.\n") ); + * DEBUGADD() - If level <= DEBUGLEVEL, then the text is appended to the + * current message (i.e., no header). + * Usage: + * DEBUGADD( 2, ("Some additional text.\n") ); + */ +#define DEBUGLVL( level ) \ + ( (DEBUGLEVEL >= (level)) \ + && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) + +#define DEBUG( level, body ) \ + (void)( (DEBUGLEVEL >= (level)) \ + && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ + && (dbgtext body) ) + +#define DEBUGADD( level, body ) \ + (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) ) + +/* End Debugging code section. + * -------------------------------------------------------------------------- ** + */ + +#endif -- cgit From 5301a0954172519fdb00185b167d814869f46a98 Mon Sep 17 00:00:00 2001 From: "Christopher R. Hertel" Date: Wed, 12 Jul 2000 03:51:06 +0000 Subject: Typo. It said "DEGUG" in the comments. I dunno how to degug, or gug for that matter. crh (This used to be commit 6ee63ecfa5f9c984f51c15597a50e085ab722e87) --- source3/include/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index c6ddf61525..e59a45cba1 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -74,7 +74,7 @@ BOOL dbgtext(); * Example usage: * if( DEBUGLVL( 2 ) ) * dbgtext( "Some text.\n" ); - * DEGUG() - Good old DEBUG(). Each call to DEBUG() will generate a new + * DEBUG() - Good old DEBUG(). Each call to DEBUG() will generate a new * header *unless* the previous debug output was unterminated * (i.e., no '\n'). See debug.c:dbghdr() for more info. * Example usage: -- cgit From 077c41cc60316c44d2f3f85e14fe15acd22ccc1f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Oct 2000 23:35:55 +0000 Subject: Fix for printf attribute from Mattias Gronlund Added "codepage directory" patch from Peter.Polkinghorne@brunel.ac.uk Jeremy. (This used to be commit e49566c2e21fcd16980e5110495645c5ae5a36da) --- source3/include/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index e59a45cba1..3130bc379d 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -40,12 +40,12 @@ #ifdef HAVE_STDARG_H int Debug1( char *, ... ) #ifdef __GNUC__ - __attribute__ ((format (printf, 1, 2))) + __attribute__ ((format (__printf__, 1, 2))) #endif ; BOOL dbgtext( char *, ... ) #ifdef __GNUC__ - __attribute__ ((format (printf, 1, 2))) + __attribute__ ((format (__printf__, 1, 2))) #endif ; #else -- cgit From 94fc44a93c46cece9b9fa947bff62087dbcd89fa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 12 Feb 2001 16:18:02 +0000 Subject: Merge of JohnR's changes to appliance-head, JF's changes to 2.2, updated the POSIX_ACL code to be in sync. Jeremy. (This used to be commit c0517d6f4e3079feca1309fd1ea7b21e83f0de02) --- source3/include/debug.h | 132 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 109 insertions(+), 23 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 3130bc379d..d2c3b1d37e 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -66,38 +66,124 @@ BOOL dbgtext(); #define FUNCTION_MACRO ("") #endif -/* Debugging macros. - * DEBUGLVL() - If level is <= the system-wide DEBUGLEVEL then generate a - * header using the default macros for file, line, and - * function name. - * Returns True if the debug level was <= DEBUGLEVEL. - * Example usage: - * if( DEBUGLVL( 2 ) ) - * dbgtext( "Some text.\n" ); - * DEBUG() - Good old DEBUG(). Each call to DEBUG() will generate a new - * header *unless* the previous debug output was unterminated - * (i.e., no '\n'). See debug.c:dbghdr() for more info. - * Example usage: - * DEBUG( 2, ("Some text.\n") ); - * DEBUGADD() - If level <= DEBUGLEVEL, then the text is appended to the - * current message (i.e., no header). - * Usage: - * DEBUGADD( 2, ("Some additional text.\n") ); +/* + * Redefine DEBUGLEVEL because so we don't have to change every source file + * that *unnecessarily* references it. Source files neeed not extern reference + * DEBUGLEVEL, as it's extern in includes.h (which all source files include). + * Eventually, all these references should be removed, and all references to + * DEBUGLEVEL should be references to DEBUGLEVEL_CLASS[DBGC_ALL]. This could + * still be through a macro still called DEBUGLEVEL. This cannot be done now + * because some references would expand incorrectly. + */ +#define DEBUGLEVEL *debug_level + + +/* + * Define all new debug classes here. A class is represented by an entry in + * the DEBUGLEVEL_CLASS array. Index zero of this arrray is equivalent to the + * old DEBUGLEVEL. Any source file that does NOT add the following lines: + * + * #undef DBGC_CLASS + * #define DBGC_CLASS DBGC_ + * + * at the start of the file (after #include "includes.h") will default to + * using index zero, so it will behaive just like it always has. + */ +#define DBGC_CLASS 0 /* override as shown above */ +#define DBGC_ALL 0 /* index equivalent to DEBUGLEVEL */ + +#define DBGC_TDB 1 +#define DBGC_PRINTDRIVERS 2 +#define DBGC_LANMAN 3 + +#define DBGC_LAST 4 /* MUST be last class value + 1 */ + + +extern int DEBUGLEVEL_CLASS[DBGC_LAST]; + + +/* Debugging macros + * + * DEBUGLVL() + * If the 'file specific' debug class level >= level OR the system-wide + * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then + * generate a header using the default macros for file, line, and + * function name. Returns True if the debug level was <= DEBUGLEVEL. + * + * Example: if( DEBUGLVL( 2 ) ) dbgtext( "Some text.\n" ); + * + * DEBUGLVLC() + * If the 'macro specified' debug class level >= level OR the system-wide + * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then + * generate a header using the default macros for file, line, and + * function name. Returns True if the debug level was <= DEBUGLEVEL. + * + * Example: if( DEBUGLVL( DBGC_TDB, 2 ) ) dbgtext( "Some text.\n" ); + * + * DEBUG() + * If the 'file specific' debug class level >= level OR the system-wide + * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then + * generate a header using the default macros for file, line, and + * function name. Each call to DEBUG() generates a new header *unless* the + * previous debug output was unterminated (i.e. no '\n'). + * See debug.c:dbghdr() for more info. + * + * Example: DEBUG( 2, ("Some text and a valu %d.\n", value) ); + * + * DEBUGC() + * If the 'macro specified' debug class level >= level OR the system-wide + * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then + * generate a header using the default macros for file, line, and + * function name. Each call to DEBUG() generates a new header *unless* the + * previous debug output was unterminated (i.e. no '\n'). + * See debug.c:dbghdr() for more info. + * + * Example: DEBUG( DBGC_TDB, 2, ("Some text and a valu %d.\n", value) ); + * + * DEBUGADD(), DEBUGADDC() + * Same as DEBUG() and DEBUGC() except the text is appended to the previous + * DEBUG(), DEBUGC(), DEBUGADD(), DEBUGADDC() with out another interviening + * header. + * + * Example: DEBUGADD( 2, ("Some text and a valu %d.\n", value) ); + * DEBUGADDC( DBGC_TDB, 2, ("Some text and a valu %d.\n", value) ); + * + * Note: If the debug class has not be redeined (see above) then the optimizer + * will remove the extra conditional test. */ + #define DEBUGLVL( level ) \ - ( (DEBUGLEVEL >= (level)) \ + ( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) + + +#define DEBUGLVLC( dbgc_class, level ) \ + ( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) + #define DEBUG( level, body ) \ - (void)( (DEBUGLEVEL >= (level)) \ + (void)( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ + && (dbgtext body) ) + +#define DEBUGC( dbgc_class, level, body ) \ + (void)( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGADD( level, body ) \ - (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) ) + (void)( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && (dbgtext body) ) -/* End Debugging code section. - * -------------------------------------------------------------------------- ** - */ +#define DEBUGADDC( dbgc_class, level, body ) \ + (void)( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && (dbgtext body) ) #endif -- cgit From d095b5249cf9e1496ad5a3d6b5acb77af2c587a7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 28 Apr 2001 13:49:34 +0000 Subject: - added test for vasprintf - cleaned up GNUC printf attribute macros - added enum handling in mkproto - removed non-vararg code - made slprintf and vslprintf just macros for snprintf and vsnprintf - don't need slprintf code any more (This used to be commit c7aeb2254dfc3cd0aa0b6c0bdd426f9323be0ddf) --- source3/include/debug.h | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index d2c3b1d37e..240da0d6fc 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -37,21 +37,8 @@ arguemnts to DEBUG() right. We have got them wrong too often in the past. */ -#ifdef HAVE_STDARG_H -int Debug1( char *, ... ) -#ifdef __GNUC__ - __attribute__ ((format (__printf__, 1, 2))) -#endif -; -BOOL dbgtext( char *, ... ) -#ifdef __GNUC__ - __attribute__ ((format (__printf__, 1, 2))) -#endif -; -#else -int Debug1(); -BOOL dbgtext(); -#endif +int Debug1( char *, ... ) PRINTF_ATTRIBUTE(1,2); +BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); /* If we have these macros, we can add additional info to the header. */ #ifdef HAVE_FILE_MACRO -- cgit From 6dce5c47c62d6ad3d74489bde3824fbfb02d8616 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 1 Jun 2001 12:04:44 +0000 Subject: If a debug class was explicitly set to zero the debug system would not recognise it as there was no distinction made between zeroing a debug class and just not setting it to anything. I've added a debuglevel_isset array in parallel with the debuglevel_class array to fix this. Added a couple of new debug classes which I might start filling out to get smb, rpc header and rpc marshall/unmarshalling debugs tidied up. Fixed a bunch of cut&paste bugs in include/debug.h Modified smbcontrol and the messaging system debug handler to like the debuglevel_isset stuff. (This used to be commit 391e7caf76cbc22021629ef0ec5e0c32806edfd7) --- source3/include/debug.h | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 240da0d6fc..0bde9e69cf 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -82,12 +82,20 @@ BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); #define DBGC_TDB 1 #define DBGC_PRINTDRIVERS 2 #define DBGC_LANMAN 3 +#define DBGC_SMB 4 +#define DBGC_RPC 5 +#define DBGC_RPC_HDR 6 +#define DBGC_BDC 7 -#define DBGC_LAST 4 /* MUST be last class value + 1 */ - +#define DBGC_LAST 8 /* MUST be last class value + 1 */ extern int DEBUGLEVEL_CLASS[DBGC_LAST]; +extern BOOL DEBUGLEVEL_CLASS_ISSET[DBGC_LAST]; +struct debuglevel_message { + int debuglevel_class[DBGC_LAST]; + BOOL debuglevel_class_isset[DBGC_LAST]; +}; /* Debugging macros * @@ -105,7 +113,7 @@ extern int DEBUGLEVEL_CLASS[DBGC_LAST]; * generate a header using the default macros for file, line, and * function name. Returns True if the debug level was <= DEBUGLEVEL. * - * Example: if( DEBUGLVL( DBGC_TDB, 2 ) ) dbgtext( "Some text.\n" ); + * Example: if( DEBUGLVLC( DBGC_TDB, 2 ) ) dbgtext( "Some text.\n" ); * * DEBUG() * If the 'file specific' debug class level >= level OR the system-wide @@ -115,7 +123,7 @@ extern int DEBUGLEVEL_CLASS[DBGC_LAST]; * previous debug output was unterminated (i.e. no '\n'). * See debug.c:dbghdr() for more info. * - * Example: DEBUG( 2, ("Some text and a valu %d.\n", value) ); + * Example: DEBUG( 2, ("Some text and a value %d.\n", value) ); * * DEBUGC() * If the 'macro specified' debug class level >= level OR the system-wide @@ -125,15 +133,15 @@ extern int DEBUGLEVEL_CLASS[DBGC_LAST]; * previous debug output was unterminated (i.e. no '\n'). * See debug.c:dbghdr() for more info. * - * Example: DEBUG( DBGC_TDB, 2, ("Some text and a valu %d.\n", value) ); + * Example: DEBUGC( DBGC_TDB, 2, ("Some text and a value %d.\n", value) ); * * DEBUGADD(), DEBUGADDC() * Same as DEBUG() and DEBUGC() except the text is appended to the previous * DEBUG(), DEBUGC(), DEBUGADD(), DEBUGADDC() with out another interviening * header. * - * Example: DEBUGADD( 2, ("Some text and a valu %d.\n", value) ); - * DEBUGADDC( DBGC_TDB, 2, ("Some text and a valu %d.\n", value) ); + * Example: DEBUGADD( 2, ("Some text and a value %d.\n", value) ); + * DEBUGADDC( DBGC_TDB, 2, ("Some text and a value %d.\n", value) ); * * Note: If the debug class has not be redeined (see above) then the optimizer * will remove the extra conditional test. @@ -141,36 +149,42 @@ extern int DEBUGLEVEL_CLASS[DBGC_LAST]; #define DEBUGLVL( level ) \ ( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ - (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + (!DEBUGLEVEL_CLASS[ DBGC_CLASS ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUGLVLC( dbgc_class, level ) \ ( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ - (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUG( level, body ) \ (void)( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ - (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGC( dbgc_class, level, body ) \ (void)( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ - (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGADD( level, body ) \ (void)( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ - (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) #define DEBUGADDC( dbgc_class, level, body ) \ (void)( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ - (DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) #endif -- cgit From b12a4dd9b655485420d5c67dd143d8f49ac28a40 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 10 Sep 2001 12:14:18 +0000 Subject: declare dbf in one spot (This used to be commit f41c3bb80f1e498a9d27f6e236b0ff3a742764c9) --- source3/include/debug.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 0bde9e69cf..cad802d8ca 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -40,6 +40,8 @@ int Debug1( char *, ... ) PRINTF_ATTRIBUTE(1,2); BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); +extern XFILE *dbf; + /* If we have these macros, we can add additional info to the header. */ #ifdef HAVE_FILE_MACRO #define FILE_MACRO (__FILE__) -- cgit From 39d7983a470cc3470dd7126de35697d965817cb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 12 Sep 2001 03:08:51 +0000 Subject: - enable MSDFS by default, there seems no reason not to have it enabled by default in Samba 3.x - got rid of some unused parameters in Makefile.in - declare DEBUGLEVEL in debug.h rather than in each file (This used to be commit b8651acb9c0d7248a6a2e82c33b1e43633fd83fd) --- source3/include/debug.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index cad802d8ca..b726859a0b 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -41,6 +41,7 @@ int Debug1( char *, ... ) PRINTF_ATTRIBUTE(1,2); BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); extern XFILE *dbf; +extern int DEBUGLEVEL; /* If we have these macros, we can add additional info to the header. */ #ifdef HAVE_FILE_MACRO -- cgit From dc1fc3ee8ec2199bc73bb5d7ec711c6800f61d65 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 2 Oct 2001 04:29:50 +0000 Subject: Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. (This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e) --- source3/include/debug.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index b726859a0b..cad802d8ca 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -41,7 +41,6 @@ int Debug1( char *, ... ) PRINTF_ATTRIBUTE(1,2); BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); extern XFILE *dbf; -extern int DEBUGLEVEL; /* If we have these macros, we can add additional info to the header. */ #ifdef HAVE_FILE_MACRO -- cgit From 94dd5cded7921da779fdeffe0e829eaaf2f4984d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Dec 2001 07:17:25 +0000 Subject: allow a MAX_DEBUG_LEVEL setting in local.h (or the Makefile) This allows embedded systems to compile out the higher debug levels. It should gain speed as well as reducing the code size. Setting it to 1 saves about 300k of code on my system. (This used to be commit f34cac3b312f273a2363919655ddd1e25cb91305) --- source3/include/debug.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index cad802d8ca..37eaed2b12 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -150,41 +150,47 @@ struct debuglevel_message { */ #define DEBUGLVL( level ) \ - ( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + ( ((level) <= MAX_DEBUG_LEVEL) && \ + ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUGLVLC( dbgc_class, level ) \ - ( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + ( ((level) <= MAX_DEBUG_LEVEL) && \ + ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUG( level, body ) \ - (void)( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGC( dbgc_class, level, body ) \ - (void)( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGADD( level, body ) \ - (void)( ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) #define DEBUGADDC( dbgc_class, level, body ) \ - (void)( ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/include/debug.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 37eaed2b12..235fbf70c4 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -1,6 +1,5 @@ /* - Unix SMB/Netbios implementation. - Version 1.9. + Unix SMB/CIFS implementation. SMB debug stuff Copyright (C) Andrew Tridgell 1992-1998 Copyright (C) John H Terpstra 1996-1998 -- cgit From e90b65284812aaa5ff9e9935ce9bbad7791cbbcd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 10:35:28 +0000 Subject: updated the 3.0 branch from the head branch - ready for alpha18 (This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce) --- source3/include/debug.h | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 235fbf70c4..0885827433 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -38,8 +38,10 @@ */ int Debug1( char *, ... ) PRINTF_ATTRIBUTE(1,2); BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); +BOOL dbghdr( int level, char *file, char *func, int line ); extern XFILE *dbf; +extern pstring debugf; /* If we have these macros, we can add additional info to the header. */ #ifdef HAVE_FILE_MACRO @@ -64,7 +66,7 @@ extern XFILE *dbf; * because some references would expand incorrectly. */ #define DEBUGLEVEL *debug_level - +extern int DEBUGLEVEL; /* * Define all new debug classes here. A class is represented by an entry in @@ -77,26 +79,27 @@ extern XFILE *dbf; * at the start of the file (after #include "includes.h") will default to * using index zero, so it will behaive just like it always has. */ +#define DBGC_ALL 0 /* index equivalent to DEBUGLEVEL */ + +#define DBGC_TDB 1 +#define DBGC_PRINTDRIVERS 2 +#define DBGC_LANMAN 3 +#define DBGC_SMB 4 +#define DBGC_RPC_PARSE 5 +#define DBGC_RPC_SRV 6 +#define DBGC_RPC_CLI 7 +#define DBGC_PASSDB 8 +#define DBGC_AUTH 9 +#define DBGC_WINBIND 10 + + +/* So you can define DBGC_CLASS before including debug.h */ +#ifndef DBGC_CLASS #define DBGC_CLASS 0 /* override as shown above */ -#define DBGC_ALL 0 /* index equivalent to DEBUGLEVEL */ - -#define DBGC_TDB 1 -#define DBGC_PRINTDRIVERS 2 -#define DBGC_LANMAN 3 -#define DBGC_SMB 4 -#define DBGC_RPC 5 -#define DBGC_RPC_HDR 6 -#define DBGC_BDC 7 - -#define DBGC_LAST 8 /* MUST be last class value + 1 */ - -extern int DEBUGLEVEL_CLASS[DBGC_LAST]; -extern BOOL DEBUGLEVEL_CLASS_ISSET[DBGC_LAST]; +#endif -struct debuglevel_message { - int debuglevel_class[DBGC_LAST]; - BOOL debuglevel_class_isset[DBGC_LAST]; -}; +extern int *DEBUGLEVEL_CLASS; +extern BOOL *DEBUGLEVEL_CLASS_ISSET; /* Debugging macros * @@ -151,7 +154,7 @@ struct debuglevel_message { #define DEBUGLVL( level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ - (!DEBUGLEVEL_CLASS[ DBGC_CLASS ] && \ + (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) -- cgit From a834a73e341059be154426390304a42e4a011f72 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 25 Sep 2002 15:19:00 +0000 Subject: sync'ing up for 3.0alpha20 release (This used to be commit 65e7b5273bb58802bf0c389b77f7fcae0a1f6139) --- source3/include/debug.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 0885827433..4b0b4b1ac4 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -89,9 +89,10 @@ extern int DEBUGLEVEL; #define DBGC_RPC_SRV 6 #define DBGC_RPC_CLI 7 #define DBGC_PASSDB 8 -#define DBGC_AUTH 9 -#define DBGC_WINBIND 10 - +#define DBGC_SAM 9 +#define DBGC_AUTH 10 +#define DBGC_WINBIND 11 +#define DBGC_VFS 12 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From 4b117b89179e49499c16d884dde9149ed1d69309 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 15 Nov 2002 14:06:35 +0000 Subject: Merge from HEAD: - heimdal updates to configure - make DEBUG() const - add testsuite for: - preexec - preexec close - valid users - fix testsuite for 'invalid users' Andrew Bartlett (This used to be commit aa41fb8703db4a4ecd3b353874c99a994e8ed630) --- source3/include/debug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 4b0b4b1ac4..5f87bf06fd 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -36,9 +36,9 @@ arguemnts to DEBUG() right. We have got them wrong too often in the past. */ -int Debug1( char *, ... ) PRINTF_ATTRIBUTE(1,2); -BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); -BOOL dbghdr( int level, char *file, char *func, int line ); +int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2); +BOOL dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2); +BOOL dbghdr( int level, const char *file, const char *func, int line ); extern XFILE *dbf; extern pstring debugf; -- cgit From 2c5e33b7f2e372b348c4aa97824078f7b62db8ff Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 5 Dec 2002 23:30:49 +0000 Subject: Merge from HEAD: >Remove FILE_MACRO as __FILE__ is ANSI C. (This used to be commit 21eb4b5a2dd2f9a6a0d3cd94408bb52359d2e926) --- source3/include/debug.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 5f87bf06fd..d4f45539f4 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -44,11 +44,6 @@ extern XFILE *dbf; extern pstring debugf; /* If we have these macros, we can add additional info to the header. */ -#ifdef HAVE_FILE_MACRO -#define FILE_MACRO (__FILE__) -#else -#define FILE_MACRO ("") -#endif #ifdef HAVE_FUNCTION_MACRO #define FUNCTION_MACRO (__FUNCTION__) @@ -157,7 +152,7 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) + && dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUGLVLC( dbgc_class, level ) \ @@ -165,7 +160,7 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) + && dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUG( level, body ) \ @@ -173,7 +168,7 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ + && (dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGC( dbgc_class, level, body ) \ @@ -181,7 +176,7 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ + && (dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGADD( level, body ) \ -- cgit From c823b191ab476fc2583d6d6aaa1e2edb09cbb88e Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 12 May 2003 18:12:31 +0000 Subject: And finally IDMAP in 3_0 We really need idmap_ldap to have a good solution with ldapsam, porting it from the prvious code is beeing made, the code is really simple to do so I am confident it is not a problem to commit this code in. Not committing it would have been worst. I really would have been able to finish also the group code, maybe we can put it into a followin release after 3.0.0 even if it may be an upgrade problem. The code has been tested and seem to work right, more testing is needed for corner cases. Currently winbind pdc (working only for users and not for groups) is disabled as I was not able to make a complete group code replacement that works somewhat in a week (I have a complete patch, but there are bugs) Simo. (This used to be commit 0e58085978f984436815114a2ec347cf7899a89d) --- source3/include/debug.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index d4f45539f4..70f9f7706d 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -88,6 +88,7 @@ extern int DEBUGLEVEL; #define DBGC_AUTH 10 #define DBGC_WINBIND 11 #define DBGC_VFS 12 +#define DBGC_IDMAP 13 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From 9343c89cb4a1b9f47c38d00b12f3e9058d15b18d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 15 Jan 2004 08:49:30 +0000 Subject: * Fix XFS quotas: XFS_USER_QUOTA -> USRQUOTA XFS_GROUP_QUOTA -> GRPQUOTA * Fix disk_free calculation with group quotas. * Add debug class 'quota' and a lot of DEBUG()'s to the quota code. metze (This used to be commit e9e5e2036f13ff847aa3ef52e8be657bef7d5774) --- source3/include/debug.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 70f9f7706d..d47f69db65 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -89,6 +89,7 @@ extern int DEBUGLEVEL; #define DBGC_WINBIND 11 #define DBGC_VFS 12 #define DBGC_IDMAP 13 +#define DBGC_QUOTA 14 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From cdcec269e0772dac2001aeb433e92144c387a5f9 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 9 Feb 2004 00:59:22 +0000 Subject: Apply James' printf format checking patch for SGI MIPSPro compiler. (This used to be commit 27242f44e6cfa10b7b7f74bcfb6c81786aaffae0) --- source3/include/debug.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index d47f69db65..55f07d8a18 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -35,8 +35,11 @@ /* I know the __attribute__ stuff is ugly, but it does ensure we get the arguemnts to DEBUG() right. We have got them wrong too often in the past. + The PRINTFLIKE comment does the equivalent for SGI MIPSPro. */ +/* PRINTFLIKE1 */ int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2); +/* PRINTFLIKE1 */ BOOL dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2); BOOL dbghdr( int level, const char *file, const char *func, int line ); -- cgit From fc52c330aed4bbfd406d96cccc273c8e551255c2 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Fri, 30 Apr 2004 14:28:38 +0000 Subject: r428: add acls debug class (This used to be commit b7703799f8899affda205eacb0bf79cf8e2b9362) --- source3/include/debug.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 55f07d8a18..52e06b9360 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -93,6 +93,7 @@ extern int DEBUGLEVEL; #define DBGC_VFS 12 #define DBGC_IDMAP 13 #define DBGC_QUOTA 14 +#define DBGC_ACLS 15 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From 03bf0d85a1a2d861cfb1eddad16583182765c977 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Sat, 3 Jul 2004 22:48:26 +0000 Subject: r1332: Typo fix. (This used to be commit 659ddcc4434afc302ebd3d48aca6b4ef68468eb2) --- source3/include/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 52e06b9360..05a9a3f0c5 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -33,7 +33,7 @@ * diffferent prototype declarations), so we must do these by hand. */ /* I know the __attribute__ stuff is ugly, but it does ensure we get the - arguemnts to DEBUG() right. We have got them wrong too often in the + arguments to DEBUG() right. We have got them wrong too often in the past. The PRINTFLIKE comment does the equivalent for SGI MIPSPro. */ -- cgit From ed1f7121a39d863066ef47e985b77fe3dbedbc9b Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Wed, 27 Apr 2005 18:32:37 +0000 Subject: r6502: add LOCKING debug class - pull PRINTINGDB class definition from trunk so our numbers don't get out of sync (This used to be commit 58e307664e02ebf0415f19ed625d2f166d9cb1cc) --- source3/include/debug.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 05a9a3f0c5..062bbe1a0a 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -94,6 +94,8 @@ extern int DEBUGLEVEL; #define DBGC_IDMAP 13 #define DBGC_QUOTA 14 #define DBGC_ACLS 15 +#define DBGC_PRINTERDB 16 +#define DBGC_LOCKING 17 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From bf547ff1ad4120f898e89fd75ec94f577a0fc84d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 28 Jun 2005 19:25:48 +0000 Subject: r7981: MS-DFS tidyup patches from James Peach . Looking forward to the day he can commit these himself :-). Jeremy. (This used to be commit 12ff2978295a84fe6177af129c495a0021befacc) --- source3/include/debug.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 062bbe1a0a..f69c213eb7 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -96,6 +96,7 @@ extern int DEBUGLEVEL; #define DBGC_ACLS 15 #define DBGC_PRINTERDB 16 #define DBGC_LOCKING 17 +#define DBGC_MSDFS 18 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From 1c3e9aff2ae2ebdc78bf5ace5e4c9e86722f1d59 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Jul 2005 14:44:12 +0000 Subject: r8427: Printerdb has been moved into a tmp branch. Guenther (This used to be commit 9dc4e4f0127b3f59ccc455bdba419a9d35eaa12e) --- source3/include/debug.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index f69c213eb7..99c96e6bb1 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -94,9 +94,8 @@ extern int DEBUGLEVEL; #define DBGC_IDMAP 13 #define DBGC_QUOTA 14 #define DBGC_ACLS 15 -#define DBGC_PRINTERDB 16 -#define DBGC_LOCKING 17 -#define DBGC_MSDFS 18 +#define DBGC_LOCKING 16 +#define DBGC_MSDFS 17 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From ed0c8e056d5f814f6ccc11c045a085d5698b22e3 Mon Sep 17 00:00:00 2001 From: James Peach Date: Sun, 15 Jan 2006 23:09:17 +0000 Subject: r12951: Tell the MIPSPro compiler to push DEBUG calls out of line. (This used to be commit a346059912c05d2b4a27892571d6e89f44907d5c) --- source3/include/debug.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 99c96e6bb1..b6fb50a9ac 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -43,6 +43,12 @@ int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2); BOOL dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2); BOOL dbghdr( int level, const char *file, const char *func, int line ); +#if defined(sgi) && (_COMPILER_VERSION >= 730) +#pragma mips_frequency_hint NEVER Debug1 +#pragma mips_frequency_hint NEVER dbgtext +#pragma mips_frequency_hint NEVER dbghdr +#endif + extern XFILE *dbf; extern pstring debugf; -- cgit From 40d0707827ee154bcb03013abe6f72f1026a70c9 Mon Sep 17 00:00:00 2001 From: James Peach Date: Wed, 22 Mar 2006 23:49:09 +0000 Subject: r14668: Set the FILE_STATUS_OFFLINE bit by observing the events a DMAPI-based HSM is interested in. Tested on both IRIX and SLES9. (This used to be commit 514a767c57f8194547e5b708ad2573ab9a0719c6) --- source3/include/debug.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index b6fb50a9ac..2cf1ceaead 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -102,6 +102,7 @@ extern int DEBUGLEVEL; #define DBGC_ACLS 15 #define DBGC_LOCKING 16 #define DBGC_MSDFS 17 +#define DBGC_DMAPI 18 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From 4fa555980070d78b39711ef21d77628d26055bc2 Mon Sep 17 00:00:00 2001 From: James Peach Date: Tue, 4 Apr 2006 00:27:50 +0000 Subject: 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) --- source3/include/debug.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 2cf1ceaead..ae9fbeba92 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -208,4 +208,8 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) +/* Print a separator to the debug log. */ +#define DEBUGSEP(level)\ + DEBUG((level),("===============================================================\n")) + #endif -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/include/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index ae9fbeba92..4ad471f142 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/include/debug.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 4ad471f142..c976268c59 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -17,8 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifndef _DEBUG_H -- cgit From d3dd14b70e1b0d25c75513bb8c3f5ecca8515ed4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 28 Sep 2007 23:03:08 +0000 Subject: r25416: Add registry debug class. Guenther (This used to be commit b28dd747cb5a3d0eee865076eb4733dc123a6968) --- source3/include/debug.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index c976268c59..dca3bc008c 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -102,6 +102,7 @@ extern int DEBUGLEVEL; #define DBGC_LOCKING 16 #define DBGC_MSDFS 17 #define DBGC_DMAPI 18 +#define DBGC_REGISTRY 19 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS -- cgit From b6a6fbd49309630e00983f9c2e654b805336ffae Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 30 Sep 2007 08:07:06 +0000 Subject: r25434: Add the option to print the debug class (DBGC_CLASS) in the debug header. Control this by a new boolean smb.conf option "debug class" which is by default set to "no" to keep the default debug header unchanged. Michael Note: You need to make clean for this patch. (This used to be commit 066a46ba91ca734d9e20cb9d6db36fec209a27d7) --- source3/include/debug.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index dca3bc008c..eb7dc76c1c 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -40,7 +40,7 @@ int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2); /* PRINTFLIKE1 */ BOOL dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2); -BOOL dbghdr( int level, const char *file, const char *func, int line ); +BOOL dbghdr( int level, int cls, const char *file, const char *func, int line ); #if defined(sgi) && (_COMPILER_VERSION >= 730) #pragma mips_frequency_hint NEVER Debug1 @@ -167,7 +167,7 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) + && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUGLVLC( dbgc_class, level ) \ @@ -175,7 +175,7 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) + && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) #define DEBUG( level, body ) \ @@ -183,7 +183,7 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && (dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ + && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGC( dbgc_class, level, body ) \ @@ -191,7 +191,7 @@ extern BOOL *DEBUGLEVEL_CLASS_ISSET; ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ - && (dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ + && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ && (dbgtext body) ) #define DEBUGADD( level, body ) \ -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/include/debug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index eb7dc76c1c..51850925e8 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -39,8 +39,8 @@ /* PRINTFLIKE1 */ int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2); /* PRINTFLIKE1 */ -BOOL dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2); -BOOL dbghdr( int level, int cls, const char *file, const char *func, int line ); +bool dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2); +bool dbghdr( int level, int cls, const char *file, const char *func, int line ); #if defined(sgi) && (_COMPILER_VERSION >= 730) #pragma mips_frequency_hint NEVER Debug1 @@ -110,7 +110,7 @@ extern int DEBUGLEVEL; #endif extern int *DEBUGLEVEL_CLASS; -extern BOOL *DEBUGLEVEL_CLASS_ISSET; +extern bool *DEBUGLEVEL_CLASS_ISSET; /* Debugging macros * -- cgit From 68be9a820059ee96dd26c527efd7c14e679d3f2c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 15 Nov 2007 14:19:52 -0800 Subject: More pstring removal. This one was tricky. I had to add one horror (pstring_clean_name()) which will have to remain until I've removed all pstrings from the client code. Jeremy. (This used to be commit 1ea3ac80146b83c2522b69e7747c823366a2b47d) --- source3/include/debug.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 51850925e8..46e5620cc7 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -49,7 +49,6 @@ bool dbghdr( int level, int cls, const char *file, const char *func, int line ); #endif extern XFILE *dbf; -extern pstring debugf; /* If we have these macros, we can add additional info to the header. */ -- cgit From ee8212472d29a5a23011d0331ad693494dcd1034 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Dec 2007 17:41:19 +0100 Subject: Wrap the DEBUG checks in a "unlikely" On my Laptop with some limited netbench runs this gains about 1.5% of performance. When looking at the assembler output I would suspect the biggest gain is by the fact that with this in place the calls to the debug functions is moved to the function end, out of the way of the normal code paths. valgrind tests pending I would suspect this to be much more cache friendly. Comments? Volker (This used to be commit 51448a9dca95de9d35dd8eea68fde2554cb69921) --- source3/include/debug.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 46e5620cc7..41d1c82366 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -161,9 +161,24 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; * will remove the extra conditional test. */ +/* + * From talloc.c: + */ + +/* these macros gain us a few percent of speed on gcc */ +#if (__GNUC__ >= 3) +/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 + as its first argument */ +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define likely(x) x +#define unlikely(x) x +#endif + #define DEBUGLVL( level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) @@ -171,7 +186,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define DEBUGLVLC( dbgc_class, level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) @@ -179,7 +194,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define DEBUG( level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ @@ -187,7 +202,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define DEBUGC( dbgc_class, level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ @@ -195,14 +210,14 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define DEBUGADD( level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) #define DEBUGADDC( dbgc_class, level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) -- cgit From 94ee39c23f6e4a8c31701240795c288299d6bb08 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 00:12:14 +0100 Subject: Fix the non-gcc branch of "likely" (This used to be commit 1e07368b5f96e4ada622682e38d260eb0c6185f2) --- source3/include/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 41d1c82366..284671c730 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -172,8 +172,8 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else -#define likely(x) x -#define unlikely(x) x +#define likely(x) (x) +#define unlikely(x) (x) #endif #define DEBUGLVL( level ) \ -- cgit From a60b913a37d577d6bb52fbdb0987eb7c9ea9edcc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 23 Jan 2008 00:30:28 +0100 Subject: Fix tab_depth: it should not create an extra debug header. In pstring removal 4ae4b23586, the behaviour of tab_depth was changed to create an extra debug header (by using the DEBUGLVL macro). This extracts the debug level check from DEBUGLVL into a macro CHECK_DEBUGLVL without the debug header creation and uses this instead of DEBUGLVL in tab_depth. Michael (This used to be commit cbc7d921fa696e6c3c5197ad9f87442ba679df82) --- source3/include/debug.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 284671c730..d8dafcbd45 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -176,11 +176,14 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define unlikely(x) (x) #endif -#define DEBUGLVL( level ) \ +#define CHECK_DEBUGLVL( level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ - DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) ) + +#define DEBUGLVL( level ) \ + ( CHECK_DEBUGLVL(level) \ && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) -- cgit From e08943f8d855b85765615b2a231fb65d5788a2a6 Mon Sep 17 00:00:00 2001 From: Karolin Seeger Date: Fri, 27 Jun 2008 15:51:35 +0200 Subject: Fix warnings on SuSE 9.0. The macros "[un]likely" are already defined on SuSE 9.0. Patch from Volker. (This used to be commit 30d181c92463aecd6e649330d3645d86d5a17e43) --- source3/include/debug.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index d8dafcbd45..d1716320b3 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -169,12 +169,20 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #if (__GNUC__ >= 3) /* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 as its first argument */ +#ifndef likely #define likely(x) __builtin_expect(!!(x), 1) +#endif +#ifndef unlikely #define unlikely(x) __builtin_expect(!!(x), 0) +#endif #else +#ifndef likely #define likely(x) (x) +#endif +#ifndef unlikely #define unlikely(x) (x) #endif +#endif #define CHECK_DEBUGLVL( level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ -- cgit