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 <stdio.h>
00036 #include <unistd.h>
00037 #include <sys/types.h>
00038 
00039 #include "int_sizes.h"
00040 
00041 #define D_SYSCALL  0x000000001  
00042 #define D_CHANNEL  0x000000002  
00043 #define D_PROCESS  0x000000004  
00044 #define D_NOTICE   0x000000008  
00045 #define D_RESOLVE  0x000000010  
00046 #define D_LIBCALL  0x000000020  
00047 #define D_LOCAL    0x000000040  
00048 #define D_DNS      0x000000080  
00049 #define D_TCP      0x000000100  
00050 #define D_AUTH     0x000000200  
00051 #define D_IRODS    0x000000400  
00052 #define D_CVMFS    0x000000800  
00053 #define D_HTTP     0x000001000  
00054 #define D_FTP      0x000002000  
00055 #define D_NEST     0x000004000  
00056 #define D_GROW     0x000008000  
00057 #define D_CHIRP    0x000010000  
00058 #define D_DCAP     0x000020000  
00059 #define D_RFIO     0x000040000  
00060 #define D_GLITE    0x000080000  
00061 #define D_MULTI    0x000100000  
00062 #define D_PSTREE   0x000200000  
00063 #define D_ALLOC    0x000400000  
00064 #define D_LFC      0x000800000  
00065 #define D_GFAL     0x001000000  
00066 #define D_SUMMARY  0x002000000  
00067 #define D_DEBUG    0x004000000  
00068 #define D_LOGIN    0x008000000  
00069 #define D_CACHE    0x010000000  
00070 #define D_POLL     0x020000000  
00071 #define D_HDFS     0x040000000  
00072 #define D_WQ       0x080000000  
00073 #define D_BXGRID   0x100000000LL  
00074 #define D_USER     0x200000000LL  
00075 #define D_XROOTD   0x400000000LL  
00076 #define D_MPI      0x800000000LL  
00079 #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)
00080 
00082 #define D_ALL      ~(0LL)
00083 
00084 /*
00085 It turns out that many libraries and tools make use of
00086 symbols like "debug" and "fatal".  This causes strange
00087 failures when we link against such codes.  Rather than change
00088 all of our code, we simply insert these defines to
00089 transparently modify the linker namespace we are using.
00090 */
00091 
00092 #define debug                  cctools_debug
00093 #define fatal                  cctools_fatal
00094 #define debug_config           cctools_debug_config
00095 #define debug_config_file      cctools_debug_config_file
00096 #define debug_config_file_size cctools_debug_config_file_size
00097 #define debug_config_fatal     cctools_debug_config_fatal
00098 #define debug_config_getpid    cctools_debug_config_getpid
00099 #define debug_flags_set        cctools_debug_flags_set
00100 #define debug_flags_print      cctools_debug_flags_print
00101 #define debug_flags_clear      cctools_debug_flags_clear
00102 #define debug_flags_restore    cctools_debug_flags_restore
00103 #define debug_set_flag_name    cctools_debug_set_flag_name
00104 
00111 void debug(INT64_T flags, const char *fmt, ...);
00112 
00118 void fatal(const char *fmt, ...);
00119 
00125 void debug_config(const char *name);
00126 
00133 void debug_config_file(const char *file);
00134 
00142 void debug_config_file_size(size_t size);
00143 
00144 void debug_config_fatal(void (*callback) (void));
00145 void debug_config_getpid(pid_t(*getpidfunc) (void));
00146 
00155 int debug_flags_set(const char *flagname);
00156 
00163 void debug_flags_print(FILE * stream);
00164 
00170 INT64_T debug_flags_clear(void);
00171 
00178 void debug_set_flag_name(INT64_T flag, const char *name);
00179 
00183 void debug_flags_restore(INT64_T flags);
00184 
00185 #endif