Changeset 215 for eaccelerator/branches/0.9.4/debug.c
- Timestamp:
- 06/21/06 21:02:56 (3 years ago)
- Files:
-
- eaccelerator/branches/0.9.4/debug.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/branches/0.9.4/debug.c
r144 r215 73 73 } 74 74 75 /* lock the log file, don't lock stderr */76 static void ea_debug_lock() {77 int rc;78 struct flock l;79 if (F_fp != stderr) {80 l.l_whence = SEEK_SET;81 l.l_start = 0;82 l.l_len = 0;83 l.l_pid = 0;84 l.l_type = F_WRLCK;85 do {86 rc = fcntl(file_no, F_SETLKW, &l);87 } while (rc < 0 && errno == EINTR);88 }89 }90 91 static void ea_debug_unlock() {92 int rc;93 struct flock l;94 if (F_fp != stderr) {95 l.l_whence = SEEK_SET;96 l.l_start = 0;97 l.l_len = 0;98 l.l_pid = 0;99 l.l_type = F_UNLCK;100 do {101 rc = fcntl(file_no, F_SETLKW, &l);102 } while (rc < 0 && errno == EINTR);103 }104 }105 106 75 /** 107 76 * Print a log message that will be print when the debug level is … … 119 88 va_end (args); 120 89 121 ea_debug_lock(); 122 #ifdef ZEND_WIN32 123 OutputDebugString (output_buf); 124 #else 125 fputs (output_buf, F_fp); 126 fflush (F_fp); 127 #endif 128 ea_debug_unlock(); 90 if (F_fp != stderr) { 91 EACCELERATOR_FLOCK(file_no, LOCK_EX); 92 } 93 fputs (output_buf, F_fp); 94 fflush (F_fp); 95 if (F_fp != stderr) { 96 EACCELERATOR_FLOCK(file_no, LOCK_UN); 97 } 98 129 99 } 130 100 }