From 36e26436b540b0889c3accd555288325e83a318f Mon Sep 17 00:00:00 2001 From: Matt Wells Date: Thu, 10 Apr 2014 23:04:00 -0700 Subject: [PATCH] logging fixes --- Log.cpp | 7 ++++++- Log.h | 2 ++ Threads.cpp | 25 ++++++++++++++----------- Threads.h | 1 + html/admin.html | 4 ++-- main.cpp | 2 ++ 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Log.cpp b/Log.cpp index 4068faf2..a15560ee 100644 --- a/Log.cpp +++ b/Log.cpp @@ -31,6 +31,10 @@ long g_dbufSize = 0; // main process id static pid_t s_pid = -1; +void Log::setPid ( ) { + s_pid = getpidtid(); +} + Log::Log () { m_fd = -1; m_filename = NULL; @@ -55,7 +59,8 @@ void Log::reset ( ) { bool Log::init ( char *filename ) { // set the main process id - s_pid = getpidtid(); + //s_pid = getpidtid(); + setPid(); // init these m_numErrors = 0; m_bufPtr = 0; diff --git a/Log.h b/Log.h index 503b4112..b3e5168f 100644 --- a/Log.h +++ b/Log.h @@ -124,6 +124,8 @@ class Log { void reset ( ); + void setPid(); + // save before exiting void close () { dumpLog(); }; diff --git a/Threads.cpp b/Threads.cpp index 419996d6..bf540a94 100644 --- a/Threads.cpp +++ b/Threads.cpp @@ -178,17 +178,7 @@ Threads::Threads ( ) { m_initialized = false; } -bool Threads::init ( ) { - - if ( m_initialized ) return true; - m_initialized = true; - - m_needsCleanup = false; - //m_needBottom = false; - - // sanity check - if ( sizeof(pthread_t) > sizeof(pid_t) ) { char *xx=NULL;*xx=0; } - +void Threads::setPid ( ) { // set s_pid to the main process id #ifdef PTHREADS s_pid = pthread_self(); @@ -207,7 +197,20 @@ bool Threads::init ( ) { #else s_pid = getpid(); #endif +} +bool Threads::init ( ) { + + if ( m_initialized ) return true; + m_initialized = true; + + m_needsCleanup = false; + //m_needBottom = false; + + // sanity check + if ( sizeof(pthread_t) > sizeof(pid_t) ) { char *xx=NULL;*xx=0; } + + setPid(); #ifdef _STACK_GROWS_UP return log("thread: Stack growing up not supported."); diff --git a/Threads.h b/Threads.h index 44294b91..15fd427a 100644 --- a/Threads.h +++ b/Threads.h @@ -172,6 +172,7 @@ class Threads { long getStack ( ) ; void returnStack ( long si ); + void setPid(); void reset ( ) ; // . we restrict the # of threads based on their type diff --git a/html/admin.html b/html/admin.html index 8ced2448..c5857256 100644 --- a/html/admin.html +++ b/html/admin.html @@ -63,7 +63,7 @@ A work-in-progress comparison to SOLR.

Quick Start

-Until I get the binary packages ready, build from the source code, it's easy. +Until I get the binary packages ready, build from the source code, it should only take about 30 seconds to type the three commands.