From 4acef317a0e1692afc526a3805adf87403651170 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 1 Mar 2011 07:40:22 +1100 Subject: lib/util move debug.[ch] out of the way This will allow a modified version of the s3 debug system to be the new common debug system. Andrew Bartlett --- lib/util/debug.c | 273 --------------------------------------------- lib/util/debug.h | 150 ------------------------- lib/util/debug_s4.c | 273 +++++++++++++++++++++++++++++++++++++++++++++ lib/util/debug_s4.h | 150 +++++++++++++++++++++++++ lib/util/wscript_build | 2 +- source4/include/includes.h | 2 +- 6 files changed, 425 insertions(+), 425 deletions(-) delete mode 100644 lib/util/debug.c delete mode 100644 lib/util/debug.h create mode 100644 lib/util/debug_s4.c create mode 100644 lib/util/debug_s4.h diff --git a/lib/util/debug.c b/lib/util/debug.c deleted file mode 100644 index 845240fdb7..0000000000 --- a/lib/util/debug.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Samba debug functions - Copyright (C) Andrew Tridgell 2003 - Copyright (C) James J Myers 2003 - - 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 3 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, see . -*/ - -#include "includes.h" -#include "system/filesys.h" -#include "system/time.h" -#include "dynconfig/dynconfig.h" - -/** - * @file - * @brief Debug logging - **/ - -/** - * this global variable determines what messages are printed - */ -int _debug_level = 0; -_PUBLIC_ int *debug_level = &_debug_level; -static int debug_all_class_hack = 1; -int *DEBUGLEVEL_CLASS = &debug_all_class_hack; /* For samba 3 */ -static bool debug_all_class_isset_hack = true; -bool *DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack; /* For samba 3 */ - -/* the registered mutex handlers */ -static struct { - const char *name; - struct debug_ops ops; -} debug_handlers; - -/* state variables for the debug system */ -static struct { - int fd; /* The log file handle */ - enum debug_logtype logtype; /* The type of logging we are doing: eg stdout, file, stderr */ - const char *prog_name; - bool reopening_logs; -} state; - -static bool reopen_logs_scheduled; -static bool check_reopen_logs(void) -{ - if (state.fd == 0 || reopen_logs_scheduled) { - reopen_logs_scheduled = false; - reopen_logs(); - } - - if (state.fd <= 0) - return false; - - return true; -} - -_PUBLIC_ void debug_schedule_reopen_logs(void) -{ - reopen_logs_scheduled = true; -} - -static void log_timestring(int level, const char *location, const char *func) -{ - char *t = NULL; - char *s = NULL; - - if (!check_reopen_logs()) return; - - if (state.logtype != DEBUG_FILE) return; - - t = timestring(NULL, time(NULL)); - if (!t) return; - - asprintf(&s, "[%s, %d %s:%s()]\n", t, level, location, func); - talloc_free(t); - if (!s) return; - - write(state.fd, s, strlen(s)); - free(s); -} - -/** - the backend for debug messages. Note that the DEBUG() macro has already - ensured that the log level has been met before this is called -*/ -_PUBLIC_ void dbghdr(int level, const char *location, const char *func) -{ - log_timestring(level, location, func); - log_task_id(); -} - - -_PUBLIC_ void dbghdrclass(int level, int dclass, const char *location, const char *func) -{ - /* Simple wrapper, Samba 4 doesn't do debug classes */ - dbghdr(level, location, func); -} - -/** - the backend for debug messages. Note that the DEBUG() macro has already - ensured that the log level has been met before this is called - - @note You should never have to call this function directly. Call the DEBUG() - macro instead. -*/ -_PUBLIC_ void dbgtext(const char *format, ...) -{ - va_list ap; - - if (!check_reopen_logs()) return; - - va_start(ap, format); - vdprintf(state.fd, format, ap); - va_end(ap); -} - -_PUBLIC_ const char *logfile = NULL; - -/** - reopen the log file (usually called because the log file name might have changed) -*/ -_PUBLIC_ void reopen_logs(void) -{ - char *fname = NULL; - int old_fd = state.fd; - if (state.reopening_logs) { - return; - } - - switch (state.logtype) { - case DEBUG_STDOUT: - case DEBUG_DEFAULT_STDOUT: - state.fd = 1; - break; - - case DEBUG_STDERR: - case DEBUG_DEFAULT_STDERR: - state.fd = 2; - break; - - case DEBUG_FILE: - state.reopening_logs = true; - if (logfile && (*logfile) == '/') { - fname = strdup(logfile); - } else { - asprintf(&fname, "%s/%s.log", dyn_LOGFILEBASE, state.prog_name); - } - if (fname) { - int newfd = open(fname, O_CREAT|O_APPEND|O_WRONLY, 0600); - if (newfd == -1) { - DEBUG(1, ("Failed to open new logfile: %s\n", fname)); - old_fd = -1; - } else { - state.fd = newfd; - } - free(fname); - } else { - DEBUG(1, ("Failed to find name for file-based logfile!\n")); - } - state.reopening_logs = false; - - break; - } - - if (old_fd > 2) { - close(old_fd); - } -} - -/* setup for logging of talloc warnings */ -static void talloc_log_fn(const char *msg) -{ - DEBUG(0,("%s", msg)); -} - -void debug_setup_talloc_log(void) -{ - talloc_set_log_fn(talloc_log_fn); -} - -/** - control the name of the logfile and whether logging will be to stdout, stderr - or a file, and set up syslog - - new_log indicates the destination for the debug log (an enum in - order of precedence - once set to DEBUG_FILE, it is not possible to - reset to DEBUG_STDOUT for example. This makes it easy to override - for debug to stderr on the command line, as the smb.conf cannot - reset it back to file-based logging -*/ -_PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype) -{ - debug_setup_talloc_log(); - if (state.logtype < new_logtype) { - state.logtype = new_logtype; - } - if (prog_name) { - state.prog_name = prog_name; - } - reopen_logs(); -} - -/** - return a string constant containing n tabs - no more than 10 tabs are returned -*/ -_PUBLIC_ const char *do_debug_tab(int n) -{ - const char *tabs[] = {"", "\t", "\t\t", "\t\t\t", "\t\t\t\t", "\t\t\t\t\t", - "\t\t\t\t\t\t", "\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t", - "\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t"}; - return tabs[MIN(n, 10)]; -} - - -/** - log suspicious usage - print comments and backtrace -*/ -_PUBLIC_ void log_suspicious_usage(const char *from, const char *info) -{ - if (!debug_handlers.ops.log_suspicious_usage) return; - - debug_handlers.ops.log_suspicious_usage(from, info); -} - - -/** - print suspicious usage - print comments and backtrace -*/ -_PUBLIC_ void print_suspicious_usage(const char* from, const char* info) -{ - if (!debug_handlers.ops.print_suspicious_usage) return; - - debug_handlers.ops.print_suspicious_usage(from, info); -} - -_PUBLIC_ uint32_t get_task_id(void) -{ - if (debug_handlers.ops.get_task_id) { - return debug_handlers.ops.get_task_id(); - } - return getpid(); -} - -_PUBLIC_ void log_task_id(void) -{ - if (!debug_handlers.ops.log_task_id) return; - - if (!check_reopen_logs()) return; - - debug_handlers.ops.log_task_id(state.fd); -} - -/** - register a set of debug handlers. -*/ -_PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops) -{ - debug_handlers.name = name; - debug_handlers.ops = *ops; -} diff --git a/lib/util/debug.h b/lib/util/debug.h deleted file mode 100644 index 055edcb3c4..0000000000 --- a/lib/util/debug.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Samba debug defines - Copyright (C) Andrew Tridgell 2003 - - 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 3 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, see . -*/ - -#ifndef _SAMBA_DEBUG_H_ -#define _SAMBA_DEBUG_H_ - -/** - * @file - * @brief Debugging macros - */ - -/* the debug operations structure - contains function pointers to - various debug implementations of each operation */ -struct debug_ops { - /* function to log (using DEBUG) suspicious usage of data structure */ - void (*log_suspicious_usage)(const char* from, const char* info); - - /* function to log (using printf) suspicious usage of data structure. - * To be used in circumstances when using DEBUG would cause loop. */ - void (*print_suspicious_usage)(const char* from, const char* info); - - /* function to return process/thread id */ - uint32_t (*get_task_id)(void); - - /* function to log process/thread id */ - void (*log_task_id)(int fd); -}; - -#define DEBUGLEVEL *debug_level -extern int DEBUGLEVEL; - -#define DEBUGLVL(level) ((level) <= DEBUGLEVEL) -#define _DEBUG(level, body, header) do { \ - if (DEBUGLVL(level)) { \ - if (header) { \ - dbghdr(level, __location__, __FUNCTION__); \ - } \ - dbgtext body; \ - } \ -} while (0) -/** - * Write to the debug log. - */ -#define DEBUG(level, body) _DEBUG(level, body, true) -/** - * Add data to an existing debug log entry. - */ -#define DEBUGADD(level, body) _DEBUG(level, body, false) - -/* Compatiblity macros for the source3 calling convention */ -#define DEBUGC(class, level, body) _DEBUG(level, body, true) -#define DEBUGADDC(class, level, body) _DEBUG(level, body, false) - -/** - * Obtain indentation string for the debug log. - * - * Level specified by n. - */ -#define DEBUGTAB(n) do_debug_tab(n) - -/** Possible destinations for the debug log (in order of precedence - - * once set to DEBUG_FILE, it is not possible to reset to DEBUG_STDOUT - * for example. This makes it easy to override for debug to stderr on - * the command line, as the smb.conf cannot reset it back to - * file-based logging */ -enum debug_logtype {DEBUG_DEFAULT_STDOUT = 0, - DEBUG_DEFAULT_STDERR, - DEBUG_STDOUT, - DEBUG_FILE, - DEBUG_STDERR}; - -/** - the backend for debug messages. Note that the DEBUG() macro has already - ensured that the log level has been met before this is called -*/ -_PUBLIC_ void dbghdr(int level, const char *location, const char *func); - -_PUBLIC_ void dbghdrclass(int level, int cls, const char *location, const char *func); - -/** - reopen the log file (usually called because the log file name might have changed) -*/ -_PUBLIC_ void reopen_logs(void); - -/** - * this global variable determines what messages are printed - */ -_PUBLIC_ void debug_schedule_reopen_logs(void); - -/** - control the name of the logfile and whether logging will be to stdout, stderr - or a file -*/ -_PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype); - -/** - return a string constant containing n tabs - no more than 10 tabs are returned -*/ -_PUBLIC_ const char *do_debug_tab(int n); - -/** - log suspicious usage - print comments and backtrace -*/ -_PUBLIC_ void log_suspicious_usage(const char *from, const char *info); - -/** - print suspicious usage - print comments and backtrace -*/ -_PUBLIC_ void print_suspicious_usage(const char* from, const char* info); -_PUBLIC_ uint32_t get_task_id(void); -_PUBLIC_ void log_task_id(void); - -/** - register a set of debug handlers. -*/ -_PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops); - -/** - the backend for debug messages. Note that the DEBUG() macro has already - ensured that the log level has been met before this is called - - @note You should never have to call this function directly. Call the DEBUG() - macro instead. -*/ -_PUBLIC_ void dbgtext(const char *format, ...) PRINTF_ATTRIBUTE(1,2); - -struct _XFILE; -extern struct _XFILE *dbf; - -/* setup talloc logging */ -void debug_setup_talloc_log(void); - -#endif diff --git a/lib/util/debug_s4.c b/lib/util/debug_s4.c new file mode 100644 index 0000000000..845240fdb7 --- /dev/null +++ b/lib/util/debug_s4.c @@ -0,0 +1,273 @@ +/* + Unix SMB/CIFS implementation. + Samba debug functions + Copyright (C) Andrew Tridgell 2003 + Copyright (C) James J Myers 2003 + + 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 3 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, see . +*/ + +#include "includes.h" +#include "system/filesys.h" +#include "system/time.h" +#include "dynconfig/dynconfig.h" + +/** + * @file + * @brief Debug logging + **/ + +/** + * this global variable determines what messages are printed + */ +int _debug_level = 0; +_PUBLIC_ int *debug_level = &_debug_level; +static int debug_all_class_hack = 1; +int *DEBUGLEVEL_CLASS = &debug_all_class_hack; /* For samba 3 */ +static bool debug_all_class_isset_hack = true; +bool *DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack; /* For samba 3 */ + +/* the registered mutex handlers */ +static struct { + const char *name; + struct debug_ops ops; +} debug_handlers; + +/* state variables for the debug system */ +static struct { + int fd; /* The log file handle */ + enum debug_logtype logtype; /* The type of logging we are doing: eg stdout, file, stderr */ + const char *prog_name; + bool reopening_logs; +} state; + +static bool reopen_logs_scheduled; +static bool check_reopen_logs(void) +{ + if (state.fd == 0 || reopen_logs_scheduled) { + reopen_logs_scheduled = false; + reopen_logs(); + } + + if (state.fd <= 0) + return false; + + return true; +} + +_PUBLIC_ void debug_schedule_reopen_logs(void) +{ + reopen_logs_scheduled = true; +} + +static void log_timestring(int level, const char *location, const char *func) +{ + char *t = NULL; + char *s = NULL; + + if (!check_reopen_logs()) return; + + if (state.logtype != DEBUG_FILE) return; + + t = timestring(NULL, time(NULL)); + if (!t) return; + + asprintf(&s, "[%s, %d %s:%s()]\n", t, level, location, func); + talloc_free(t); + if (!s) return; + + write(state.fd, s, strlen(s)); + free(s); +} + +/** + the backend for debug messages. Note that the DEBUG() macro has already + ensured that the log level has been met before this is called +*/ +_PUBLIC_ void dbghdr(int level, const char *location, const char *func) +{ + log_timestring(level, location, func); + log_task_id(); +} + + +_PUBLIC_ void dbghdrclass(int level, int dclass, const char *location, const char *func) +{ + /* Simple wrapper, Samba 4 doesn't do debug classes */ + dbghdr(level, location, func); +} + +/** + the backend for debug messages. Note that the DEBUG() macro has already + ensured that the log level has been met before this is called + + @note You should never have to call this function directly. Call the DEBUG() + macro instead. +*/ +_PUBLIC_ void dbgtext(const char *format, ...) +{ + va_list ap; + + if (!check_reopen_logs()) return; + + va_start(ap, format); + vdprintf(state.fd, format, ap); + va_end(ap); +} + +_PUBLIC_ const char *logfile = NULL; + +/** + reopen the log file (usually called because the log file name might have changed) +*/ +_PUBLIC_ void reopen_logs(void) +{ + char *fname = NULL; + int old_fd = state.fd; + if (state.reopening_logs) { + return; + } + + switch (state.logtype) { + case DEBUG_STDOUT: + case DEBUG_DEFAULT_STDOUT: + state.fd = 1; + break; + + case DEBUG_STDERR: + case DEBUG_DEFAULT_STDERR: + state.fd = 2; + break; + + case DEBUG_FILE: + state.reopening_logs = true; + if (logfile && (*logfile) == '/') { + fname = strdup(logfile); + } else { + asprintf(&fname, "%s/%s.log", dyn_LOGFILEBASE, state.prog_name); + } + if (fname) { + int newfd = open(fname, O_CREAT|O_APPEND|O_WRONLY, 0600); + if (newfd == -1) { + DEBUG(1, ("Failed to open new logfile: %s\n", fname)); + old_fd = -1; + } else { + state.fd = newfd; + } + free(fname); + } else { + DEBUG(1, ("Failed to find name for file-based logfile!\n")); + } + state.reopening_logs = false; + + break; + } + + if (old_fd > 2) { + close(old_fd); + } +} + +/* setup for logging of talloc warnings */ +static void talloc_log_fn(const char *msg) +{ + DEBUG(0,("%s", msg)); +} + +void debug_setup_talloc_log(void) +{ + talloc_set_log_fn(talloc_log_fn); +} + +/** + control the name of the logfile and whether logging will be to stdout, stderr + or a file, and set up syslog + + new_log indicates the destination for the debug log (an enum in + order of precedence - once set to DEBUG_FILE, it is not possible to + reset to DEBUG_STDOUT for example. This makes it easy to override + for debug to stderr on the command line, as the smb.conf cannot + reset it back to file-based logging +*/ +_PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype) +{ + debug_setup_talloc_log(); + if (state.logtype < new_logtype) { + state.logtype = new_logtype; + } + if (prog_name) { + state.prog_name = prog_name; + } + reopen_logs(); +} + +/** + return a string constant containing n tabs + no more than 10 tabs are returned +*/ +_PUBLIC_ const char *do_debug_tab(int n) +{ + const char *tabs[] = {"", "\t", "\t\t", "\t\t\t", "\t\t\t\t", "\t\t\t\t\t", + "\t\t\t\t\t\t", "\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t", + "\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t"}; + return tabs[MIN(n, 10)]; +} + + +/** + log suspicious usage - print comments and backtrace +*/ +_PUBLIC_ void log_suspicious_usage(const char *from, const char *info) +{ + if (!debug_handlers.ops.log_suspicious_usage) return; + + debug_handlers.ops.log_suspicious_usage(from, info); +} + + +/** + print suspicious usage - print comments and backtrace +*/ +_PUBLIC_ void print_suspicious_usage(const char* from, const char* info) +{ + if (!debug_handlers.ops.print_suspicious_usage) return; + + debug_handlers.ops.print_suspicious_usage(from, info); +} + +_PUBLIC_ uint32_t get_task_id(void) +{ + if (debug_handlers.ops.get_task_id) { + return debug_handlers.ops.get_task_id(); + } + return getpid(); +} + +_PUBLIC_ void log_task_id(void) +{ + if (!debug_handlers.ops.log_task_id) return; + + if (!check_reopen_logs()) return; + + debug_handlers.ops.log_task_id(state.fd); +} + +/** + register a set of debug handlers. +*/ +_PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops) +{ + debug_handlers.name = name; + debug_handlers.ops = *ops; +} diff --git a/lib/util/debug_s4.h b/lib/util/debug_s4.h new file mode 100644 index 0000000000..055edcb3c4 --- /dev/null +++ b/lib/util/debug_s4.h @@ -0,0 +1,150 @@ +/* + Unix SMB/CIFS implementation. + Samba debug defines + Copyright (C) Andrew Tridgell 2003 + + 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 3 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, see . +*/ + +#ifndef _SAMBA_DEBUG_H_ +#define _SAMBA_DEBUG_H_ + +/** + * @file + * @brief Debugging macros + */ + +/* the debug operations structure - contains function pointers to + various debug implementations of each operation */ +struct debug_ops { + /* function to log (using DEBUG) suspicious usage of data structure */ + void (*log_suspicious_usage)(const char* from, const char* info); + + /* function to log (using printf) suspicious usage of data structure. + * To be used in circumstances when using DEBUG would cause loop. */ + void (*print_suspicious_usage)(const char* from, const char* info); + + /* function to return process/thread id */ + uint32_t (*get_task_id)(void); + + /* function to log process/thread id */ + void (*log_task_id)(int fd); +}; + +#define DEBUGLEVEL *debug_level +extern int DEBUGLEVEL; + +#define DEBUGLVL(level) ((level) <= DEBUGLEVEL) +#define _DEBUG(level, body, header) do { \ + if (DEBUGLVL(level)) { \ + if (header) { \ + dbghdr(level, __location__, __FUNCTION__); \ + } \ + dbgtext body; \ + } \ +} while (0) +/** + * Write to the debug log. + */ +#define DEBUG(level, body) _DEBUG(level, body, true) +/** + * Add data to an existing debug log entry. + */ +#define DEBUGADD(level, body) _DEBUG(level, body, false) + +/* Compatiblity macros for the source3 calling convention */ +#define DEBUGC(class, level, body) _DEBUG(level, body, true) +#define DEBUGADDC(class, level, body) _DEBUG(level, body, false) + +/** + * Obtain indentation string for the debug log. + * + * Level specified by n. + */ +#define DEBUGTAB(n) do_debug_tab(n) + +/** Possible destinations for the debug log (in order of precedence - + * once set to DEBUG_FILE, it is not possible to reset to DEBUG_STDOUT + * for example. This makes it easy to override for debug to stderr on + * the command line, as the smb.conf cannot reset it back to + * file-based logging */ +enum debug_logtype {DEBUG_DEFAULT_STDOUT = 0, + DEBUG_DEFAULT_STDERR, + DEBUG_STDOUT, + DEBUG_FILE, + DEBUG_STDERR}; + +/** + the backend for debug messages. Note that the DEBUG() macro has already + ensured that the log level has been met before this is called +*/ +_PUBLIC_ void dbghdr(int level, const char *location, const char *func); + +_PUBLIC_ void dbghdrclass(int level, int cls, const char *location, const char *func); + +/** + reopen the log file (usually called because the log file name might have changed) +*/ +_PUBLIC_ void reopen_logs(void); + +/** + * this global variable determines what messages are printed + */ +_PUBLIC_ void debug_schedule_reopen_logs(void); + +/** + control the name of the logfile and whether logging will be to stdout, stderr + or a file +*/ +_PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype); + +/** + return a string constant containing n tabs + no more than 10 tabs are returned +*/ +_PUBLIC_ const char *do_debug_tab(int n); + +/** + log suspicious usage - print comments and backtrace +*/ +_PUBLIC_ void log_suspicious_usage(const char *from, const char *info); + +/** + print suspicious usage - print comments and backtrace +*/ +_PUBLIC_ void print_suspicious_usage(const char* from, const char* info); +_PUBLIC_ uint32_t get_task_id(void); +_PUBLIC_ void log_task_id(void); + +/** + register a set of debug handlers. +*/ +_PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops); + +/** + the backend for debug messages. Note that the DEBUG() macro has already + ensured that the log level has been met before this is called + + @note You should never have to call this function directly. Call the DEBUG() + macro instead. +*/ +_PUBLIC_ void dbgtext(const char *format, ...) PRINTF_ATTRIBUTE(1,2); + +struct _XFILE; +extern struct _XFILE *dbf; + +/* setup talloc logging */ +void debug_setup_talloc_log(void); + +#endif diff --git a/lib/util/wscript_build b/lib/util/wscript_build index e472ff73b5..cc53dd3f75 100644 --- a/lib/util/wscript_build +++ b/lib/util/wscript_build @@ -18,7 +18,7 @@ bld.SAMBA_LIBRARY('samba-util-common', if bld.env._SAMBA_BUILD_ == 4: bld.SAMBA_LIBRARY('samba-util', - source='''debug.c dprintf.c fault.c + source='''debug_s4.c dprintf.c fault.c ms_fnmatch.c parmlist.c substitute.c util_str.c ''', deps='samba-util-common', diff --git a/source4/include/includes.h b/source4/include/includes.h index d0a97020c6..a4ef19a042 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -57,7 +57,7 @@ #endif #include "../lib/util/xfile.h" #include "../lib/util/attr.h" -#include "../lib/util/debug.h" +#include "../lib/util/debug_s4.h" #include "../lib/util/util.h" #include "libcli/util/error.h" -- cgit