Fix macOS build (#146)

* Fix macOS build
* Fix *BSD build
* Add missing *BSD include
This commit is contained in:
exstrim401
2022-11-27 16:48:27 +03:00
committed by GitHub
parent 53bd92f7a8
commit 2fb712af66
45 changed files with 107 additions and 98 deletions

View File

@@ -16,8 +16,8 @@
#include <sys/resource.h>
#include <unistd.h>
#if defined(OSX) || defined(BSD)
# ifdef BSD
#if defined(OSX) || defined(PLATFORM_BSD)
# ifdef PLATFORM_BSD
# include <sys/proc.h>
# include <sys/user.h>
# else
@@ -441,7 +441,7 @@ PLATFORM_INTERFACE void Plat_SetAllocErrorFn( Plat_AllocErrorFn fn )
#endif // !NO_HOOK_MALLOC
#if defined( OSX ) || defined(BSD)
#if defined( OSX ) || defined(PLATFORM_BSD)
// From the Apple tech note: http://developer.apple.com/library/mac/#qa/qa1361/_index.html
bool Plat_IsInDebugSession()
@@ -451,7 +451,7 @@ bool Plat_IsInDebugSession()
struct kinfo_proc info;
size_t size;
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()};
#ifndef BSD
#ifndef PLATFORM_BSD
info.kp_proc.p_flag = 0;
#endif
@@ -459,7 +459,7 @@ bool Plat_IsInDebugSession()
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
// We're being debugged if the P_TRACED flag is set.
#ifdef BSD
#ifdef PLATFORM_BSD
s_IsInDebugSession = info.ki_flag & P_TRACED;
#else
s_IsInDebugSession = info.kp_proc.p_flag & P_TRACED;
@@ -559,7 +559,7 @@ PLATFORM_INTERFACE const char *Plat_GetCommandLineA()
PLATFORM_INTERFACE bool GetMemoryInformation( MemoryInformation *pOutMemoryInfo )
{
#if defined( LINUX ) || defined( OSX ) || defined(BSD)
#if defined( LINUX ) || defined( OSX ) || defined(PLATFORM_BSD)
return false;
#else
#error "Need to fill out GetMemoryInformation or at least return false for this platform"
@@ -571,7 +571,7 @@ PLATFORM_INTERFACE bool Is64BitOS()
{
#if defined OSX
return true;
#elif defined(LINUX) || defined(BSD)
#elif defined(LINUX) || defined(PLATFORM_BSD)
FILE *pp = popen( "uname -m", "r" );
if ( pp != NULL )
{
@@ -781,7 +781,7 @@ static void InstallHooks( void )
__realloc_hook = ReallocHook;
}
#elif OSX || BSD
#elif OSX || PLATFORM_BSD
static void RemoveHooks( void )