if (Debug::Enabled(83, 4)) {
/* Write out the SSL session details.. actually the call below, but
* OpenSSL headers do strange typecasts confusing GCC.. */
- /* PEM_write_SSL_SESSION(debug_log, SSL_get_session(ssl)); */
+ /* PEM_write_SSL_SESSION(DebugStream(), SSL_get_session(ssl)); */
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x00908000L
PEM_ASN1_write(reinterpret_cast<i2d_of_void *>(i2d_SSL_SESSION),
- PEM_STRING_SSL_SESSION, debug_log,
+ PEM_STRING_SSL_SESSION, DebugStream(),
reinterpret_cast<char *>(SSL_get_session(session.get())),
nullptr, nullptr, 0, nullptr, nullptr);
* commented line. */
PEM_ASN1_write((int(*)())i2d_SSL_SESSION, PEM_STRING_SSL_SESSION,
- debug_log,
+ DebugStream(),
reinterpret_cast<char *>(SSL_get_session(session.get())),
nullptr, nullptr, 0, nullptr, nullptr);
/* PEM_ASN1_write((int(*)(...))i2d_SSL_SESSION, PEM_STRING_SSL_SESSION,
- debug_log,
+ DebugStream(),
reinterpret_cast<char *>(SSL_get_session(session.get())),
nullptr, nullptr, 0, nullptr, nullptr);
*/
/// cache.log FILE or, as the last resort, stderr stream;
/// may be nil during static initialization and destruction!
FILE *DebugStream();
-/// change-avoidance macro; new code should call DebugStream() instead
-#define debug_log DebugStream()
/// a hack for low-level file descriptor manipulations in ipcCreate()
void ResyncDebugLog(FILE *newDestination);
if (!F->flags.open)
continue;
- if (i == fileno(debug_log))
+ if (i == fileno(DebugStream()))
continue;
debugs(51, Important(17), "Open FD "<< std::left<< std::setw(10) <<
/*
* This double-dup stuff avoids problems when one of
- * crfd, cwfd, or debug_log are in the rage 0-2.
+ * crfd, cwfd, or DebugStream() are in the rage 0-2.
*/
do {
t2 = dupOrExit(cwfd);
- t3 = dupOrExit(fileno(debug_log));
+ t3 = dupOrExit(fileno(DebugStream()));
assert(t1 > 2 && t2 > 2 && t3 > 2);
close(cwfd);
- close(fileno(debug_log));
+ close(fileno(DebugStream()));
dup2(t1, 0);
dup2(p2c[1], 1);
- dup2(fileno(debug_log), 2);
+ dup2(fileno(DebugStream()), 2);
close(c2p[0]);
if (newkey) {
if (Debug::Enabled(83, 5))
- PEM_write_RSAPrivateKey(debug_log, rsa, nullptr, nullptr, 0, nullptr, nullptr);
+ PEM_write_RSAPrivateKey(DebugStream(), rsa, nullptr, nullptr, 0, nullptr, nullptr);
debugs(83, DBG_IMPORTANT, "Generated ephemeral RSA key of length " << keylen);
}
#if HAVE_MSTATS && HAVE_GNUMALLOC_H
struct mstats ms = mstats();
- fprintf(debug_log, "\ttotal space in arena: %6d KB\n",
+ fprintf(DebugStream(), "\ttotal space in arena: %6d KB\n",
(int) (ms.bytes_total >> 10));
- fprintf(debug_log, "\tTotal free: %6d KB %d%%\n",
+ fprintf(DebugStream(), "\tTotal free: %6d KB %d%%\n",
(int) (ms.bytes_free >> 10),
Math::intPercent(ms.bytes_free, ms.bytes_total));
#endif
struct rusage rusage;
squid_getrusage(&rusage);
- fprintf(debug_log, "CPU Usage: %.3f seconds = %.3f user + %.3f sys\n",
+ fprintf(DebugStream(), "CPU Usage: %.3f seconds = %.3f user + %.3f sys\n",
rusage_cputime(&rusage),
rusage.ru_utime.tv_sec + ((double) rusage.ru_utime.tv_usec / 1000000.0),
rusage.ru_stime.tv_sec + ((double) rusage.ru_stime.tv_usec / 1000000.0));
- fprintf(debug_log, "Maximum Resident Size: %d KB\n",
+ fprintf(DebugStream(), "Maximum Resident Size: %d KB\n",
rusage_maxrss(&rusage));
- fprintf(debug_log, "Page faults with physical i/o: %d\n",
+ fprintf(DebugStream(), "Page faults with physical i/o: %d\n",
rusage_pagefaults(&rusage));
}
#if _SQUID_HPUX_
{
extern void U_STACK_TRACE(void); /* link with -lcl */
- fflush(debug_log);
- dup2(fileno(debug_log), 2);
+ fflush(DebugStream());
+ dup2(fileno(DebugStream()), 2);
U_STACK_TRACE();
}
#if _SQUID_SOLARIS_ && HAVE_LIBOPCOM_STACK
{ /* get ftp://opcom.sun.ca/pub/tars/opcom_stack.tar.gz and */
extern void opcom_stack_trace(void); /* link with -lopcom_stack */
- fflush(debug_log);
- dup2(fileno(debug_log), fileno(stdout));
+ fflush(DebugStream());
+ dup2(fileno(DebugStream()), fileno(stdout));
opcom_stack_trace();
fflush(stdout);
}
static void *callarray[8192];
int n;
n = backtrace(callarray, 8192);
- backtrace_symbols_fd(callarray, n, fileno(debug_log));
+ backtrace_symbols_fd(callarray, n, fileno(DebugStream()));
}
#endif
void
logsFlush(void)
{
- if (debug_log)
- fflush(debug_log);
+ if (DebugStream())
+ fflush(DebugStream());
}
void