Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/util/debug.h

    r746 r988  
    2121*/
    2222
    23 #ifndef _DEBUG_H
    24 #define _DEBUG_H
     23#ifndef _SAMBA_DEBUG_H
     24#define _SAMBA_DEBUG_H
     25
     26#include <stdbool.h>
     27#include <stddef.h>
     28#include <stdarg.h>
     29#include "attr.h"
     30
    2531
    2632/* -------------------------------------------------------------------------- **
     
    3743#endif
    3844
    39 int  Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2);
     45bool dbgtext_va(const char *, va_list ap) PRINTF_ATTRIBUTE(1,0);
    4046bool dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2);
    4147bool dbghdrclass( int level, int cls, const char *location, const char *func);
     
    8086#define DBGC_DMAPI              18
    8187#define DBGC_REGISTRY           19
    82 
    83 /* Always ensure this is updated when new fixed classes area added, to ensure the array in debug.c is the right size */
    84 #define DBGC_MAX_FIXED          19
     88#define DBGC_SCAVENGER          20
     89#define DBGC_DNS                21
     90#define DBGC_LDB                22
     91#define DBGC_TEVENT             23
    8592
    8693/* So you can define DBGC_CLASS before including debug.h */
     
    160167    unlikely(DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level)))
    161168
     169#define CHECK_DEBUGLVLC( dbgc_class, level ) \
     170  ( ((level) <= MAX_DEBUG_LEVEL) && \
     171    unlikely(DEBUGLEVEL_CLASS[ dbgc_class ] >= (level)))
     172
    162173#define DEBUGLVL( level ) \
    163174  ( CHECK_DEBUGLVL(level) \
    164175   && dbghdrclass( level, DBGC_CLASS, __location__, __FUNCTION__ ) )
    165176
     177#define DEBUGLVLC( dbgc_class, level ) \
     178  ( CHECK_DEBUGLVLC( dbgc_class, level ) \
     179   && dbghdrclass( level, dbgc_class, __location__, __FUNCTION__ ) )
    166180
    167181#define DEBUG( level, body ) \
     
    190204#define DEBUGSEP(level)\
    191205        DEBUG((level),("===============================================================\n"))
     206
     207/* Prefix messages with the function name */
     208#define DBG_PREFIX(level, body ) \
     209        (void)( ((level) <= MAX_DEBUG_LEVEL) &&                 \
     210                unlikely(DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))     \
     211                && (dbghdrclass(level, DBGC_CLASS, __location__, __func__ )) \
     212                && (dbgtext("%s: ", __func__))                          \
     213                && (dbgtext body) )
     214
     215/*
     216 * Debug levels matching RFC 3164
     217 */
     218#define DBGLVL_ERR       0      /* error conditions */
     219#define DBGLVL_WARNING   1      /* warning conditions */
     220#define DBGLVL_NOTICE    3      /* normal, but significant, condition */
     221#define DBGLVL_INFO      5      /* informational message */
     222#define DBGLVL_DEBUG    10      /* debug-level message */
     223
     224#define DBG_ERR(...)            DBG_PREFIX(DBGLVL_ERR,          (__VA_ARGS__))
     225#define DBG_WARNING(...)        DBG_PREFIX(DBGLVL_WARNING,      (__VA_ARGS__))
     226#define DBG_NOTICE(...)         DBG_PREFIX(DBGLVL_NOTICE,       (__VA_ARGS__))
     227#define DBG_INFO(...)           DBG_PREFIX(DBGLVL_INFO,         (__VA_ARGS__))
     228#define DBG_DEBUG(...)          DBG_PREFIX(DBGLVL_DEBUG,        (__VA_ARGS__))
    192229
    193230/* The following definitions come from lib/debug.c  */
     
    198235 * the command line, as the smb.conf cannot reset it back to
    199236 * file-based logging */
    200 enum debug_logtype {DEBUG_DEFAULT_STDERR = 0, DEBUG_STDOUT = 1, DEBUG_FILE = 2, DEBUG_STDERR = 3};
     237enum debug_logtype {
     238        DEBUG_DEFAULT_STDERR = 0,
     239        DEBUG_DEFAULT_STDOUT = 1,
     240        DEBUG_FILE = 2,
     241        DEBUG_STDOUT = 3,
     242        DEBUG_STDERR = 4,
     243        DEBUG_CALLBACK = 5
     244};
    201245
    202246struct debug_settings {
    203247        size_t max_log_size;
    204         int syslog;
    205         bool syslog_only;
    206248        bool timestamp_logs;
    207249        bool debug_prefix_timestamp;
     
    214256void setup_logging(const char *prog_name, enum debug_logtype new_logtype);
    215257
    216 void debug_close_dbf(void);
    217258void gfree_debugsyms(void);
    218259int debug_add_class(const char *classname);
    219 int debug_lookup_classname(const char *classname);
    220260bool debug_parse_levels(const char *params_str);
    221261void debug_setup_talloc_log(void);
    222262void debug_set_logfile(const char *name);
    223 void debug_set_settings(struct debug_settings *settings);
     263void debug_set_settings(struct debug_settings *settings,
     264                        const char *logging_param,
     265                        int syslog_level, bool syslog_only);
    224266bool reopen_logs_internal( void );
    225267void force_check_log_size( void );
     
    228270void dbgflush( void );
    229271bool dbghdrclass(int level, int cls, const char *location, const char *func);
    230 bool dbghdr(int level, const char *location, const char *func);
    231272bool debug_get_output_is_stderr(void);
     273bool debug_get_output_is_stdout(void);
    232274void debug_schedule_reopen_logs(void);
    233275char *debug_list_class_names_and_levels(void);
    234276
     277typedef void (*debug_callback_fn)(void *private_ptr, int level, const char *msg);
     278
    235279/**
    236   log suspicious usage - print comments and backtrace
    237 */     
    238 _PUBLIC_ void log_suspicious_usage(const char *from, const char *info);
    239 
    240 /**
    241   print suspicious usage - print comments and backtrace
    242 */     
    243 _PUBLIC_ void print_suspicious_usage(const char* from, const char* info);
    244 _PUBLIC_ uint32_t get_task_id(void);
    245 _PUBLIC_ void log_task_id(void);
    246 
    247 /* the debug operations structure - contains function pointers to
    248    various debug implementations of each operation */
    249 struct debug_ops {
    250         /* function to log (using DEBUG) suspicious usage of data structure */
    251         void (*log_suspicious_usage)(const char* from, const char* info);
    252 
    253         /* function to log (using printf) suspicious usage of data structure.
    254          * To be used in circumstances when using DEBUG would cause loop. */
    255         void (*print_suspicious_usage)(const char* from, const char* info);
    256 
    257         /* function to return process/thread id */
    258         uint32_t (*get_task_id)(void);
    259 
    260         /* function to log process/thread id */
    261         void (*log_task_id)(int fd);
    262 };
    263 
    264 /**
    265   register a set of debug handlers.
    266 */
    267 _PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops);
    268 
    269 #endif
     280   Set a callback for all debug messages.  Use in dlz_bind9 to push output to the bind logs
     281 */
     282void debug_set_callback(void *private_ptr, debug_callback_fn fn);
     283
     284#endif /* _SAMBA_DEBUG_H */
Note: See TracChangeset for help on using the changeset viewer.