cctools
debug.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3 Copyright (C) 2005- The University of Notre Dame
4 This software is distributed under the GNU General Public License.
5 See the file COPYING for details.
6 */
7 
8 #ifndef DEBUG_H
9 #define DEBUG_H
10 
35 #include <stdio.h>
36 #include <unistd.h>
37 #include <sys/types.h>
38 
39 #include "int_sizes.h"
40 
41 #define D_SYSCALL 0x000000001
42 #define D_CHANNEL 0x000000002
43 #define D_PROCESS 0x000000004
44 #define D_NOTICE 0x000000008
45 #define D_RESOLVE 0x000000010
46 #define D_LIBCALL 0x000000020
47 #define D_LOCAL 0x000000040
48 #define D_DNS 0x000000080
49 #define D_TCP 0x000000100
50 #define D_AUTH 0x000000200
51 #define D_IRODS 0x000000400
52 #define D_CVMFS 0x000000800
53 #define D_HTTP 0x000001000
54 #define D_FTP 0x000002000
55 #define D_NEST 0x000004000
56 #define D_GROW 0x000008000
57 #define D_CHIRP 0x000010000
58 #define D_DCAP 0x000020000
59 #define D_RFIO 0x000040000
60 #define D_GLITE 0x000080000
61 #define D_MULTI 0x000100000
62 #define D_PSTREE 0x000200000
63 #define D_ALLOC 0x000400000
64 #define D_LFC 0x000800000
65 #define D_GFAL 0x001000000
66 #define D_SUMMARY 0x002000000
67 #define D_DEBUG 0x004000000
68 #define D_LOGIN 0x008000000
69 #define D_CACHE 0x010000000
70 #define D_POLL 0x020000000
71 #define D_HDFS 0x040000000
72 #define D_WQ 0x080000000
73 #define D_BXGRID 0x100000000LL
74 #define D_USER 0x200000000LL
75 #define D_XROOTD 0x400000000LL
76 #define D_MPI 0x800000000LL
79 #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)
80 
82 #define D_ALL ~(0LL)
83 
84 /*
85 It turns out that many libraries and tools make use of
86 symbols like "debug" and "fatal". This causes strange
87 failures when we link against such codes. Rather than change
88 all of our code, we simply insert these defines to
89 transparently modify the linker namespace we are using.
90 */
91 
92 #define debug cctools_debug
93 #define fatal cctools_fatal
94 #define debug_config cctools_debug_config
95 #define debug_config_file cctools_debug_config_file
96 #define debug_config_file_size cctools_debug_config_file_size
97 #define debug_config_fatal cctools_debug_config_fatal
98 #define debug_config_getpid cctools_debug_config_getpid
99 #define debug_flags_set cctools_debug_flags_set
100 #define debug_flags_print cctools_debug_flags_print
101 #define debug_flags_clear cctools_debug_flags_clear
102 #define debug_flags_restore cctools_debug_flags_restore
103 #define debug_set_flag_name cctools_debug_set_flag_name
104 
111 void debug(INT64_T flags, const char *fmt, ...);
112 
118 void fatal(const char *fmt, ...);
119 
125 void debug_config(const char *name);
126 
133 void debug_config_file(const char *file);
134 
142 void debug_config_file_size(size_t size);
143 
144 void debug_config_fatal(void (*callback) (void));
145 void debug_config_getpid(pid_t(*getpidfunc) (void));
146 
155 int debug_flags_set(const char *flagname);
156 
163 void debug_flags_print(FILE * stream);
164 
170 INT64_T debug_flags_clear(void);
171 
178 void debug_set_flag_name(INT64_T flag, const char *name);
179 
183 void debug_flags_restore(INT64_T flags);
184 
185 #endif
void debug_flags_print(FILE *stream)
Display the available debug flags.
void debug_flags_restore(INT64_T flags)
Restore debug flags.
void fatal(const char *fmt,...)
Emit a fatal debugging message and exit.
void debug_config_file_size(size_t size)
Set the maximum debug file size.
int debug_flags_set(const char *flagname)
Set debugging flags to enable output.
void debug(INT64_T flags, const char *fmt,...)
Emit a debugging message.
void debug_config_file(const char *file)
Direct debug output to a file.
void debug_config(const char *name)
Initialize the debugging system.
void debug_set_flag_name(INT64_T flag, const char *name)
Set name of flag combination Sets the string value associated with flag.
INT64_T debug_flags_clear(void)
Clear all debugging flags.