Changeset 2336 for zzuf/trunk/src
- Timestamp:
- May 18, 2008, 8:13:45 PM (13 years ago)
- Location:
- zzuf/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/src/debug.c
r2326 r2336 39 39 extern int _zz_debugfd; 40 40 41 /** 42 * Helper macro to write an integer value to a given file descriptor, 43 * either in base 10 or in hexadecimal. 44 */ 41 45 #define WRITE_INT(fd, i, base) \ 42 46 do \ … … 53 57 } while(0) 54 58 59 /** 60 * Format a string, printf-like, and write the resulting data to zzuf's 61 * debug file descriptor _zz_debugfd. If the debug file descriptor is 62 * still -1, this function does nothing. 63 * 64 * This function's code is roughly equivalent to the following *printf 65 * calls, except it only uses signal-safe functions: 66 * - fprintf(stderr, "** zzuf debug ** "); 67 * - vfprintf(stderr, format, args); 68 * - fprintf(stderr, "\n"); 69 */ 55 70 void _zz_debug(char const *format, ...) 56 71 { … … 65 80 saved_errno = errno; 66 81 va_start(args, format); 67 68 #if 069 /* This function's code is equivalent to the following *printf calls,70 * except it only uses signal-safe functions */71 fprintf(stderr, "** zzuf debug ** ");72 vfprintf(stderr, format, args);73 fprintf(stderr, "\n");74 #endif75 82 76 83 write(_zz_debugfd, "** zzuf debug ** ", 17); -
zzuf/trunk/src/fd.c
r2326 r2336 71 71 /* Create lock. This lock variable is used to disable file descriptor 72 72 * creation wrappers. For instance on Mac OS X, fopen() calls open() 73 * and we don’t want open() to do any zzuf-related stuff ,fopen() takes73 * and we don’t want open() to do any zzuf-related stuff: fopen() takes 74 74 * care of everything. */ 75 75 static int create_lock = 0; -
zzuf/trunk/src/libzzuf.c
r1858 r2336 55 55 #endif 56 56 57 /* Global variables */ 57 /** 58 * Is libzzuf fully initialised? 59 */ 58 60 int _zz_ready = 0; 61 62 /** 63 * The file descriptor used by libzzuf for communication with the main 64 * zzuf program in debug mode. Its value is set by the ZZUF_DEBUG 65 * environment variable. 66 */ 59 67 int _zz_debugfd = -1; 68 69 /** 70 * If set to 1, this boolean variable will prevent the called application 71 * from installing signal handlers that would prevent it from really crashing. 72 * SDL applications often do that when not using SDL_INIT_NOPARACHUTE, for 73 * instance. Its value is set by the ZZUF_SIGNAL environment variable. 74 */ 60 75 int _zz_signal = 0; 76 77 /** 78 * If set to a positive value, this value will indicate the maximum number 79 * of megabytes that the called application will be allowed to allocate. Its 80 * value is set by the ZZUF_MEMORY environment variable. 81 */ 61 82 int _zz_memory = 0; 83 84 /** 85 * If set to 1, this boolean will tell libzzuf to fuzz network file 86 * descriptors, too. Its value is set by the ZZUF_NETWORK environment 87 * variable. 88 */ 62 89 int _zz_network = 0; 63 90 64 /* Library initialisation shit */ 91 /** 92 * Library initialisation routine. 93 * 94 * This function reads all configuration variables put by zzuf in the 95 * called process's environment and initialises diversions for the three 96 * main function families: memory functions (initialised very early because 97 * other functions we need such as dlsym() require them), file descriptor 98 * functions and stream functions. 99 */ 65 100 void _zz_init(void) 66 101 { … … 139 174 } 140 175 141 /* Deinitialisation */ 176 /** 177 * Library deinitialisation routine. 178 * 179 * Free all the memory allocated by libzzuf during its lifetime. 180 */ 142 181 void _zz_fini(void) 143 182 { … … 164 203 } 165 204 #endif 205
Note: See TracChangeset
for help on using the changeset viewer.