Changeset 2336 for zzuf


Ignore:
Timestamp:
May 18, 2008, 8:13:45 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Start working on the internal code documentation.
Location:
zzuf/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/debug.c

    r2326 r2336  
    3939extern int _zz_debugfd;
    4040
     41/**
     42 * Helper macro to write an integer value to a given file descriptor,
     43 * either in base 10 or in hexadecimal.
     44 */
    4145#define WRITE_INT(fd, i, base) \
    4246    do \
     
    5357    } while(0)
    5458
     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 */
    5570void _zz_debug(char const *format, ...)
    5671{
     
    6580    saved_errno = errno;
    6681    va_start(args, format);
    67 
    68 #if 0
    69     /* 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 #endif
    7582
    7683    write(_zz_debugfd, "** zzuf debug ** ", 17);
  • zzuf/trunk/src/fd.c

    r2326 r2336  
    7171/* Create lock. This lock variable is used to disable file descriptor
    7272 * 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() takes
     73 * and we don’t want open() to do any zzuf-related stuff: fopen() takes
    7474 * care of everything. */
    7575static int create_lock = 0;
  • zzuf/trunk/src/libzzuf.c

    r1858 r2336  
    5555#endif
    5656
    57 /* Global variables */
     57/**
     58 * Is libzzuf fully initialised?
     59 */
    5860int   _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 */
    5967int   _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 */
    6075int   _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 */
    6182int   _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 */
    6289int   _zz_network  = 0;
    6390
    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 */
    65100void _zz_init(void)
    66101{
     
    139174}
    140175
    141 /* Deinitialisation */
     176/**
     177 * Library deinitialisation routine.
     178 *
     179 * Free all the memory allocated by libzzuf during its lifetime.
     180 */
    142181void _zz_fini(void)
    143182{
     
    164203}
    165204#endif
     205
Note: See TracChangeset for help on using the changeset viewer.