BSD stuff. Some of this seems like it should be in its own file...

This commit is contained in:
Steve Checkoway
2006-03-20 06:46:19 +00:00
parent 988e1729f9
commit 3a304b1a41
3 changed files with 37 additions and 0 deletions
@@ -7,6 +7,7 @@
#include "Backtrace.h"
#include "archutils/Unix/RunningUnderValgrind.h"
#if defined(LINUX)
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
@@ -238,6 +239,31 @@ bool GetThreadBacktraceContext( uint64_t ThreadID, BacktraceContext *ctx )
}
#endif
#elif defined(BSD)
#include <pthread.h>
#include <signal.h>
RString ThreadsVersion()
{
return "(unknown)";
}
uint64_t GetCurrentThreadId()
{
return uint64_t( pthread_self() );
}
int SuspendThread( uint64_t id )
{
return pthread_kill( id, SIGSTOP );
}
int ResumeThread( uint64_t id )
{
return pthread_kill( id, SIGCONT );
}
#endif
/*
* (c) 2004 Glenn Maynard
* All rights reserved.
@@ -14,6 +14,8 @@
#if defined(MACOSX)
extern "C" int sigaltstack(const stack_t * __restrict, stack_t * __restrict);
#endif
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON
#endif
@@ -5,6 +5,15 @@
#include <stdint.h>
#endif
#ifdef BSD
#include <sys/param.h>
#undef ALIGN
#undef MACHINE
#if defined(__NetBSD_Version__) && __NetBSD_Version < 299000900
#define lrintf(x) ((int)rint(x))
#endif
#endif
#define HAVE_CRYPTOPP
// XXX: Maybe we should make sure we're using GCC first?