debug.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
00003 Copyright (C) 2005- The University of Notre Dame
00004 This software is distributed under the GNU General Public License.
00005 See the file COPYING for details.
00006 */
00007 
00008 #ifndef DEBUG_H
00009 #define DEBUG_H
00010 
00035 #include "int_sizes.h"
00036 
00037 #include <unistd.h>
00038 
00039 #include <sys/types.h>
00040 
00041 #include <stdarg.h>
00042 #include <stdio.h>
00043 
00044 /* priority */
00045 #define D_INFO     (0LL)     
00046 #define D_FATAL    (1LL<<0)  
00047 #define D_ERROR    (1LL<<1)  
00048 #define D_NOTICE   (1LL<<2)  
00049 #define D_DEBUG    (1LL<<3)  
00051 /* subsystem */
00052 #define D_SYSCALL  (1LL<<4)  
00053 #define D_CHANNEL  (1LL<<5)  
00054 #define D_PROCESS  (1LL<<6)  
00055 #define D_RESOLVE  (1LL<<7)  
00056 #define D_LIBCALL  (1LL<<8)  
00057 #define D_LOCAL    (1LL<<9)  
00058 #define D_DNS      (1LL<<10)  
00059 #define D_TCP      (1LL<<11)  
00060 #define D_AUTH     (1LL<<12)  
00061 #define D_IRODS    (1LL<<13)  
00062 #define D_CVMFS    (1LL<<14)  
00063 #define D_HTTP     (1LL<<15)  
00064 #define D_FTP      (1LL<<16)  
00065 #define D_NEST     (1LL<<17)  
00066 #define D_GROW     (1LL<<18)  
00067 #define D_CHIRP    (1LL<<19)  
00068 #define D_DCAP     (1LL<<20)  
00069 #define D_RFIO     (1LL<<21)  
00070 #define D_GLITE    (1LL<<22)  
00071 #define D_MULTI    (1LL<<23)  
00072 #define D_PSTREE   (1LL<<24)  
00073 #define D_ALLOC    (1LL<<25)  
00074 #define D_LFC      (1LL<<26)  
00075 #define D_GFAL     (1LL<<27)  
00076 #define D_SUMMARY  (1LL<<28)  
00077 #define D_LOGIN    (1LL<<29)  
00078 #define D_CACHE    (1LL<<30)  
00079 #define D_POLL     (1LL<<31)  
00080 #define D_HDFS     (1LL<<32)  
00081 #define D_WQ       (1LL<<33)  
00082 #define D_BXGRID   (1LL<<34)  
00083 #define D_USER     (1LL<<35)  
00084 #define D_XROOTD   (1LL<<36)  
00085 #define D_MPI      (1LL<<37)  
00086 #define D_BATCH    (1LL<<38)  
00087 #define D_RMON     (1LL<<39)  
00088 #define D_MAKEFLOW_RUN    (1LL<<40)  
00089 #define D_MAKEFLOW_LEXER  (1LL<<41)  
00090 #define D_MAKEFLOW_PARSER (1LL<<42)  
00091 #define D_MAKEFLOW_ALLOC  (1LL<<43)  
00092 #define D_CONFUGA  (1LL<<44)  
00093 #define D_JX       (1LL<<45)  
00094 #define D_MAKEFLOW_HOOK  (1LL<<46)  
00097 #define D_REMOTE   (D_HTTP|D_FTP|D_NEST|D_CHIRP|D_DCAP|D_RFIO|D_LFC|D_GFAL|D_MULTI|D_GROW|D_IRODS|D_HDFS|D_BXGRID|D_XROOTD|D_CVMFS)
00098 
00100 #define D_MAKEFLOW    (D_MAKEFLOW_RUN|D_MAKEFLOW_LEXER|D_MAKEFLOW_PARSER)
00101 
00103 #define D_ALL      (~(0LL))
00104 
00105 /*
00106 It turns out that many libraries and tools make use of symbols like "debug" and
00107 "fatal".  This causes strange failures when we link against such codes.  Rather
00108 than change all of our code, we simply insert these defines to transparently
00109 modify the linker namespace we are using.
00110 */
00111 
00112 #define debug                  cctools_debug
00113 #define fatal                  cctools_fatal
00114 #define notice                 cctools_notice
00115 #define warn                   cctools_warn
00116 #define debug_config           cctools_debug_config
00117 #define debug_config_file      cctools_debug_config_file
00118 #define debug_config_file_size cctools_debug_config_file_size
00119 #define debug_config_fatal     cctools_debug_config_fatal
00120 #define debug_config_getpid    cctools_debug_config_getpid
00121 #define debug_flags_set        cctools_debug_flags_set
00122 #define debug_flags_print      cctools_debug_flags_print
00123 #define debug_flags_clear      cctools_debug_flags_clear
00124 #define debug_flags_restore    cctools_debug_flags_restore
00125 #define debug_set_flag_name    cctools_debug_set_flag_name
00126 #define debug_rename           cctools_debug_rename
00127 
00134 void debug(INT64_T flags, const char *fmt, ...)
00135 #ifndef SWIG
00136 __attribute__ (( format(printf,2,3) ))
00137 #endif
00138 ;
00139 
00147 void vdebug(INT64_T flags, const char *fmt, va_list args);
00148 
00155 void warn(INT64_T flags, const char *fmt, ...);
00156 
00162 void fatal(const char *fmt, ...);
00163 
00164 
00170 void notice(INT64_T flags, const char *fmt, ...);
00171 
00177 void debug_config(const char *name);
00178 
00185 void debug_config_file(const char *file);
00186 
00187 int debug_config_file_e(const char *file);
00188 
00196 void debug_config_file_size(off_t size);
00197 
00198 void debug_config_fatal(void (*callback) (void));
00199 
00200 void debug_config_getpid (pid_t (*getpidf)(void));
00201 
00210 int debug_flags_set(const char *flagname);
00211 
00218 void debug_flags_print(FILE * stream);
00219 
00225 INT64_T debug_flags_clear(void);
00226 
00233 void debug_set_flag_name(INT64_T flag, const char *name);
00234 
00238 void debug_flags_restore(INT64_T flags);
00239 
00243 void debug_rename(const char *suffix);
00244 
00247 void debug_reopen(void);
00248 
00249 /* LDEBUG likes debug, but also print the code location.
00250  * NOTE: the caller of this macro must supply at least one argument after the format string.
00251  */
00252 #define LDEBUG(fmt, ...) debug(D_DEBUG, "%s:%s:%d[%s]: " fmt, __func__, __FILE__, __LINE__, CCTOOLS_SOURCE, __VA_ARGS__)
00253 
00254 #endif

Generated on 17 Sep 2019 for cctools by  doxygen 1.6.1