diff options
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/debug.h | 132 | ||||
-rw-r--r-- | source3/include/proto.h | 7 |
2 files changed, 115 insertions, 24 deletions
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_<your class name here> + * + * 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 diff --git a/source3/include/proto.h b/source3/include/proto.h index 8196c01569..9e0ab60c24 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -49,6 +49,10 @@ uint32 crc32_calc_buffer( char *buffer, uint32 count); /*The following definitions come from lib/debug.c */ +char* debug_classname_from_index(int idx); +int debug_lookup_classname(char* classname); +BOOL debug_parse_params(char **params, int *debuglevel_class); +BOOL debug_parse_levels(char *params_str); void debug_message(int msg_type, pid_t src, void *buf, size_t len); void debug_message_send(pid_t pid, int level); void setup_logging(char *pname, BOOL interactive); @@ -179,7 +183,7 @@ void init_msrpc_use(void); void free_msrpc_use(void); struct msrpc_state *msrpc_use_add(const char* pipe_name, uint32 pid, - const struct user_creds *usr_creds, + struct user_creds *usr_creds, BOOL redir); BOOL msrpc_use_del(const char* pipe_name, const struct user_creds *usr_creds, @@ -1589,6 +1593,7 @@ int lp_maxprotocol(void); int lp_security(void); int lp_maxdisksize(void); int lp_lpqcachetime(void); +int lp_max_smbd_processes(void); int lp_totalprintjobs(void); int lp_syslog(void); int lp_client_code_page(void); |