home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / manage / condor / Condor_4.1.3b / src / h / debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-30  |  3.3 KB  |  92 lines

  1. /* 
  2. ** Copyright 1986, 1987, 1988, 1989, 1990, 1991 by the Condor Design Team
  3. ** 
  4. ** Permission to use, copy, modify, and distribute this software and its
  5. ** documentation for any purpose and without fee is hereby granted,
  6. ** provided that the above copyright notice appear in all copies and that
  7. ** both that copyright notice and this permission notice appear in
  8. ** supporting documentation, and that the names of the University of
  9. ** Wisconsin and the Condor Design Team not be used in advertising or
  10. ** publicity pertaining to distribution of the software without specific,
  11. ** written prior permission.  The University of Wisconsin and the Condor
  12. ** Design Team make no representations about the suitability of this
  13. ** software for any purpose.  It is provided "as is" without express
  14. ** or implied warranty.
  15. ** 
  16. ** THE UNIVERSITY OF WISCONSIN AND THE CONDOR DESIGN TEAM DISCLAIM ALL
  17. ** WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  18. ** OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE UNIVERSITY OF
  19. ** WISCONSIN OR THE CONDOR DESIGN TEAM BE LIABLE FOR ANY SPECIAL, INDIRECT
  20. ** OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
  21. ** OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  22. ** OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  23. ** OR PERFORMANCE OF THIS SOFTWARE.
  24. ** 
  25. ** Authors:  Allan Bricker and Michael J. Litzkow,
  26. **              University of Wisconsin, Computer Sciences Dept.
  27. ** 
  28. */ 
  29.  
  30.  
  31. /*
  32. **    Definitions for flags to pass to dprintf
  33. */
  34. #define D_ALWAYS    (1<<0)
  35. #define D_TERMLOG    (1<<1)
  36. #define D_SYSCALLS    (1<<2)
  37. #define D_CKPT        (1<<3)
  38. #define D_XDR        (1<<4)
  39. #define D_MALLOC    (1<<5)
  40. #define D_NOHEADER    (1<<6)
  41. #define D_LOAD        (1<<7)
  42. #define D_EXPR        (1<<8)
  43. #define D_PROC        (1<<9)
  44. #define D_JOB        (1<<10)
  45. #define D_MACHINE    (1<<11)
  46. #define D_FULLDEBUG    (1<<12)
  47. #define D_MAXFLAGS    32
  48.  
  49. #define D_ALL        (~D_NOHEADER)
  50.  
  51. /*
  52. **    Important external variables...
  53. */
  54.  
  55. extern int errno;
  56.  
  57. extern int DebugFlags;    /* Bits to look for in dprintf                       */
  58. extern int MaxLog;        /* Maximum size of log file (if D_TRUNCATE is set)   */
  59. extern char *DebugFile;    /* Name of the log file (or NULL)                    */
  60. extern char *DebugLock;    /* Name of the lock file (or NULL)                   */
  61. extern int (*DebugId)();/* Function to call to print special info (or NULL)  */
  62. extern FILE *DebugFP;    /* The FILE to perform output to                     */
  63.  
  64. extern char *DebugFlagNames[];
  65.  
  66. #ifdef MALLOC_DEBUG
  67. #define MALLOC(size) mymalloc(__FILE__,__LINE__,size)
  68. #define CALLOC(nelem,size) mycalloc(__FILE__,__LINE__,nelem,size)
  69. #define REALLOC(ptr,size) myrealloc(__FILE__,__LINE__,ptr,size)
  70. #define FREE(ptr) myfree(__FILE__,__LINE__,ptr)
  71. char    *mymalloc(), *myrealloc(), *mycalloc();
  72. #else MALLOC_DEBUG
  73. #define MALLOC(size) malloc(size)
  74. #define CALLOC(nelem,size) calloc(nelem,size)
  75. #define REALLOC(ptr,size) realloc(ptr,size)
  76. #define FREE(ptr) free(ptr)
  77. #endif MALLOC_DEBUG
  78. char    *malloc(), *realloc(), *calloc();
  79.  
  80. #ifdef AIX31
  81. #define BIN_MAIL "/usr/bin/mail"
  82. #else
  83. #define BIN_MAIL "/bin/mail"
  84. #endif
  85.  
  86. #define D_RUSAGE( flags, ptr ) { \
  87.     dprintf( flags, "(ptr)->ru_utime = %d.%06d\n", (ptr)->ru_utime.tv_sec, \
  88.                                             (ptr)->ru_utime.tv_usec ); \
  89.     dprintf( flags, "(ptr)->ru_stime = %d.%06d\n", (ptr)->ru_stime.tv_sec, \
  90.                                             (ptr)->ru_stime.tv_usec ); \
  91. }
  92.