Browse Source

OpenBSD Fixes

Redo of the OpenBSD fixes by @bentley (previous pull requests were made
against master).

Adds missing codepaths for OpenBSD using the built-in TORQUE_OS_OPENBSD
define.

Resolves collision issue with time() on certain systems.
chaigler 9 years ago
parent
commit
c3de7c3629

+ 4 - 4
engine/source/audio/audio.cc

@@ -2474,7 +2474,7 @@ bool OpenALInit()
       return false;
       return false;
 
 
    // Create an openAL context
    // Create an openAL context
-#ifdef TORQUE_OS_LINUX
+#if defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_OPENBSD)
    int freq = Con::getIntVariable("Pref::Unix::OpenALFrequency");
    int freq = Con::getIntVariable("Pref::Unix::OpenALFrequency");
    if (freq == 0)
    if (freq == 0)
       freq = 22050;
       freq = 22050;
@@ -2504,7 +2504,7 @@ bool OpenALInit()
       return false;
       return false;
 
 
    // Make this context the active context
    // Make this context the active context
-#if defined(TORQUE_OS_ANDROID) || defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_EMSCRIPTEN)
+#if defined(TORQUE_OS_ANDROID) || defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_EMSCRIPTEN) || defined(TORQUE_OS_OPENBSD)
    alcMakeContextCurrent((ALCcontext*)mContext);
    alcMakeContextCurrent((ALCcontext*)mContext);
 #else
 #else
    alcMakeContextCurrent(mContext);
    alcMakeContextCurrent(mContext);
@@ -2590,7 +2590,7 @@ void OpenALShutdown()
 
 
    if (mContext)
    if (mContext)
    {
    {
-#if defined(TORQUE_OS_ANDROID) || defined(TORQUE_OS_LINUX)
+#if defined(TORQUE_OS_ANDROID) || defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_OPENBSD)
 	   alcDestroyContext((ALCcontext*)mContext);
 	   alcDestroyContext((ALCcontext*)mContext);
 #elif defined(TORQUE_OS_EMSCRIPTEN)
 #elif defined(TORQUE_OS_EMSCRIPTEN)
       alcDestroyContext((ALCcontext*)mContext);
       alcDestroyContext((ALCcontext*)mContext);
@@ -2602,7 +2602,7 @@ void OpenALShutdown()
    }
    }
    if (mDevice)
    if (mDevice)
    {
    {
-#if defined(TORQUE_OS_ANDROID) || defined(TORQUE_OS_LINUX)
+#if defined(TORQUE_OS_ANDROID) || defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_OPENBSD)
 	   alcCloseDevice((ALCdevice*)mDevice);
 	   alcCloseDevice((ALCdevice*)mDevice);
 #elif defined(TORQUE_OS_EMSCRIPTEN)
 #elif defined(TORQUE_OS_EMSCRIPTEN)
       alcCloseDevice((ALCdevice*)mDevice);
       alcCloseDevice((ALCdevice*)mDevice);

+ 1 - 1
engine/source/platform/platformAL.h

@@ -35,7 +35,7 @@
 //Android uses openal soft from https://github.com/AerialX/openal-soft-android
 //Android uses openal soft from https://github.com/AerialX/openal-soft-android
 #include <AL/al.h>
 #include <AL/al.h>
 #include <AL/alc.h>
 #include <AL/alc.h>
-#elif defined(TORQUE_OS_LINUX)
+#elif defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_OPENBSD)
 #include <AL/al.h>
 #include <AL/al.h>
 #include <AL/alc.h>
 #include <AL/alc.h>
 #include "platform/eaxtypes.h"
 #include "platform/eaxtypes.h"

+ 1 - 1
engine/source/platform/platformFileIO.h

@@ -26,7 +26,7 @@
 #include "platform/platform.h"
 #include "platform/platform.h"
 #endif
 #endif
 
 
-#ifdef TORQUE_OS_LINUX
+#if defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_OPENBSD)
 // Need to remove this once Xlib stops leaking
 // Need to remove this once Xlib stops leaking
 #undef Status
 #undef Status
 #endif
 #endif

+ 6 - 6
engine/source/platformX86UNIX/x86UNIXCPUInfo.cc

@@ -39,7 +39,7 @@ void detectX86CPUInfo(char *vendor, U32 *processor, U32 *properties);
 }
 }
 
 
 /* used in the asm */
 /* used in the asm */
-static U32 time[2];
+static U32 Ttime[2];
 static U32 clockticks = 0;
 static U32 clockticks = 0;
 static char vendor[13] = {0,};
 static char vendor[13] = {0,};
 static U32 properties = 0;
 static U32 properties = 0;
@@ -59,7 +59,7 @@ void Processor::init()
    PlatformSystemInfo.processor.mhz  = 0;
    PlatformSystemInfo.processor.mhz  = 0;
    PlatformSystemInfo.processor.properties = CPU_PROP_C;
    PlatformSystemInfo.processor.properties = CPU_PROP_C;
 
 
-   clockticks = properties = processor = time[0] = 0;
+   clockticks = properties = processor = Ttime[0] = 0;
    dStrcpy(vendor, "");
    dStrcpy(vendor, "");
 
 
    detectX86CPUInfo(vendor, &processor, &properties);
    detectX86CPUInfo(vendor, &processor, &properties);
@@ -82,8 +82,8 @@ void Processor::init()
          "pushl  %eax\n"
          "pushl  %eax\n"
          "pushl  %edx\n"
          "pushl  %edx\n"
          "rdtsc\n"
          "rdtsc\n"
-         "movl   %eax, (time)\n"
-         "movl   %edx, (time+4)\n"
+         "movl   %eax, (Ttime)\n"
+         "movl   %edx, (Ttime+4)\n"
          "popl   %edx\n"
          "popl   %edx\n"
          "popl   %eax\n"
          "popl   %eax\n"
          );
          );
@@ -102,8 +102,8 @@ void Processor::init()
          "pushl  %eax\n"
          "pushl  %eax\n"
          "pushl  %edx\n"
          "pushl  %edx\n"
          "rdtsc\n"
          "rdtsc\n"
-         "sub    (time+4), %edx\n"
-         "sbb    (time), %eax\n"
+         "sub    (Ttime+4), %edx\n"
+         "sbb    (Ttime), %eax\n"
          "mov    %eax, (clockticks)\n"
          "mov    %eax, (clockticks)\n"
          "popl   %edx\n"
          "popl   %edx\n"
          "popl   %eax\n"
          "popl   %eax\n"

+ 1 - 1
engine/source/platformX86UNIX/x86UNIXProcessControl.cc

@@ -145,7 +145,7 @@ void ProcessControlInit()
 
 
    // we're not interested in the exit status of child processes, so this 
    // we're not interested in the exit status of child processes, so this 
    // prevents zombies from accumulating.
    // prevents zombies from accumulating.
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
    signal(SIGCHLD, SIG_IGN);
    signal(SIGCHLD, SIG_IGN);
 #else
 #else
    signal(SIGCLD, SIG_IGN);
    signal(SIGCLD, SIG_IGN);