pthread_t pid_t compatibility fixes

This commit is contained in:
Matt 2014-12-10 13:15:26 -08:00
parent 619e980a97
commit feed7d5b3c
4 changed files with 14 additions and 10 deletions

View File

@ -607,7 +607,8 @@ bool HttpRequest::set ( char *origReq , int32_t origReqLen , TcpSocket *sock ) {
bool multipart = false;
if ( m_requestType == 2 ) { // is POST?
char *cd =strcasestr(req,"Content-Type: multipart/form-data");
char *cd ;
cd = gb_strcasestr(req,"Content-Type: multipart/form-data");
if ( cd ) multipart = true;
}

View File

@ -979,14 +979,16 @@ void Images::thumbStart_r ( bool amThread ) {
makeTrashDir();
// get thread id
int32_t id = getpidtid();
// get thread id. pthread_t is 64 bit and pid_t is 32 bit on
// 64 bit oses
pthread_t id = getpidtid();
// pass the input to the program through this file
// rather than a pipe, since popen() seems broken.
// m_dir ends in / so this should work.
char in[364];
snprintf ( in , 363,"%strash/in.%"INT32"", g_hostdb.m_dir, id );
snprintf ( in , 363,"%strash/in.%"INT64""
, g_hostdb.m_dir, (int64_t)id );
unlink ( in );
log( LOG_DEBUG, "image: thumbStart_r create in file." );
@ -994,7 +996,8 @@ void Images::thumbStart_r ( bool amThread ) {
// collect the output from the filter from this file
// m_dir ends in / so this should work.
char out[364];
snprintf ( out , 363,"%strash/out.%"INT32"", g_hostdb.m_dir, id );
snprintf ( out , 363,"%strash/out.%"INT64""
, g_hostdb.m_dir, (int64_t)id );
unlink ( out );
log( LOG_DEBUG, "image: thumbStart_r create out file." );

View File

@ -28,8 +28,8 @@ static pthread_mutex_t s_lock = PTHREAD_MUTEX_INITIALIZER;
char *g_dbuf = NULL;
int32_t g_dbufSize = 0;
// main process id
static pid_t s_pid = -1;
// main process id. pthread_t is 64 bit and pid_t is 32 bit on 64 bit oses
static pthread_t s_pid = (pthread_t)-1;
void Log::setPid ( ) {
s_pid = getpidtid();
@ -246,7 +246,7 @@ bool Log::logR ( int64_t now , int32_t type , char *msg , bool asterisk ,
// chop off any spaces at the end of the msg.
while ( is_wspace_a ( msg [ msgLen - 1 ] ) && msgLen > 0 ) msgLen--;
// get this pid
pid_t pid = getpidtid();
pthread_t pid = getpidtid();
// a tmp buffer
char tt [ MAX_LINE_LEN ];
char *p = tt;
@ -291,7 +291,7 @@ bool Log::logR ( int64_t now , int32_t type , char *msg , bool asterisk ,
// MDW... no i like it
//while ( p < pend && *x && is_alnum_a(*x) ) { x++; cc--; }
// thread id if in "thread"
if ( pid != s_pid && s_pid != -1 ) {
if ( pid != s_pid && s_pid != (pthread_t)-1 ) {
//sprintf ( p , "[%"INT32"] " , (int32_t)getpid() );
sprintf ( p , "[%"UINT32"] " , (uint32_t)pid );
p += gbstrlen ( p );

View File

@ -5,7 +5,7 @@ Profiler::Profiler(){return;}
Profiler::~Profiler(){return;}
bool Profiler::reset(){return true;}
bool Profiler::init(){return true;}
char *Profiler::getFnName(uint32_t address,int32_t *nameLen){return NULL;}
char *Profiler::getFnName(PTRTYPE address,int32_t *nameLen){return NULL;}
void Profiler::stopRealTimeProfiler(const bool keepData){return;}
void Profiler::cleanup(){return;}
bool Profiler:: readSymbolTable(){return true;}