Changeset 188 for branches/client-1.5
- Timestamp:
- May 5, 2009, 7:32:24 PM (16 years ago)
- Location:
- branches/client-1.5/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/client-1.5/src/debug.c
r151 r188 2 2 Netdrive Samba client plugin 3 3 logging functions 4 Copyright (C) netlabs.org 2003-200 84 Copyright (C) netlabs.org 2003-2009 5 5 6 6 This program is free software; you can redistribute it and/or modify … … 27 27 #include <string.h> 28 28 #include <sys/types.h> 29 #include <process.h>30 29 #include <sys/time.h> 31 30 32 #include "smbwrp.h" 33 //#include "smbcd.h" 34 //#include "config.h" 35 36 #define SMBCD_MAX_THREADS 250 31 // #include "smbwrp.h" 37 32 38 33 int debuglevel = 0; 39 HMTX logmutex = 0;40 34 char *logfile = NULL; 41 35 42 36 43 #if 0 44 int debug_parse_levels(const char *params_str) 37 void dbgfileinit(char *file, int loglevel) 45 38 { 46 return 1; 39 logfile = file; 40 debuglevel = loglevel; 47 41 } 48 49 void dbgflush( void )50 {51 // if (!logfile) fflush(stdout);52 }53 #endif54 42 55 43 int debuglvl(int level) … … 61 49 { 62 50 int rc; 63 if (level > debuglevel) 64 { 65 return 0; 66 } 67 rc = DosRequestMutexSem(logmutex, -1L); 68 if (rc) 51 if (!debuglvl(level)) 69 52 { 70 53 return 0; … … 92 75 gettimeofday(&tv, NULL); 93 76 t = time(NULL); 94 // strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime((time_t *)&tv.tv_sec));95 77 strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime(&t)); 96 78 fprintf(f, "%s.%d: %d %d: %s:%s(%d) :", buf, tv.tv_usec / 10000, level, (long)_gettid(), file, func, line); … … 101 83 } 102 84 while (0); 103 DosReleaseMutexSem(logmutex);104 85 return rc; 105 86 } … … 107 88 int debugmessage(char * fmt, ...) 108 89 { 109 int rc;110 rc = DosRequestMutexSem(logmutex, -1L);111 if (rc)112 {113 return 0;114 }115 90 do 116 91 { … … 138 113 } 139 114 while (0); 140 DosReleaseMutexSem(logmutex);141 115 return 0; 142 116 } … … 144 118 void debuglocal(int level, const char * fmt, ...) 145 119 { 146 int rc; 147 if (level > debuglevel) 148 { 149 return; 150 } 151 rc = DosRequestMutexSem(logmutex, -1L); 152 if (rc) 120 121 if (!debuglvl(level)) 153 122 { 154 123 return; … … 184 153 } 185 154 while (0); 186 DosReleaseMutexSem(logmutex);187 155 } 188 189 -
branches/client-1.5/src/ndpsmb.c
r183 r188 503 503 { 504 504 StrNCpy(pRes->logfile, q, sizeof(pRes->logfile) - 1); 505 }505 } 506 506 507 507 t = 0; … … 560 560 } 561 561 #endif 562 563 // init the debug part 564 dbgfileinit(&pRes->logfile, pRes->loglevel); 562 565 563 566 return rc; … … 2129 2132 } 2130 2133 2134
Note:
See TracChangeset
for help on using the changeset viewer.