OpenBSD support

This commit is contained in:
David Carlier 2017-07-25 05:59:10 +01:00 committed by Rachael Alexanderson
parent e42500c07a
commit 64e96c5f46
10 changed files with 23 additions and 21 deletions

View File

@ -15,7 +15,7 @@
#include <errno.h>
#include <stdarg.h>
#include <signal.h>
#if !defined(__APPLE__) && !defined(__FreeBSD__)
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
#include <malloc.h>
#endif
#include <time.h>

View File

@ -38,6 +38,8 @@
#elif defined(__APPLE__)
#include <stdlib.h>
#include <malloc/malloc.h>
#elif defined(__OpenBSD__)
#include <stdlib.h>
#else
#include <malloc.h>
#endif
@ -52,14 +54,14 @@
#endif
#if defined(__APPLE__)
#define _msize(p) malloc_size(p)
#elif defined(__sun)
#elif __solaris__ || defined(__OpenBSD__)
#define _msize(p) (*((size_t*)(p)-1))
#elif !defined(_WIN32)
#define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD
#endif
#ifndef _DEBUG
#if !defined(__sun)
#if !__solaris__ && !defined(__OpenBSD__)
void *M_Malloc(size_t size)
{
void *block = malloc(size);
@ -129,7 +131,7 @@ void *M_Realloc(void *memblock, size_t size)
#include <crtdbg.h>
#endif
#if !defined(__sun)
#if !__solaris__ && !defined(__OpenBSD__)
void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
{
void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno);
@ -197,7 +199,7 @@ void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
#endif
#endif
#if !defined(__sun)
#if !__solaris__ && !defined(__OpenBSD__)
void M_Free (void *block)
{
if (block != NULL)

View File

@ -30,6 +30,8 @@
#include <dirent.h>
#include <ctype.h>
#define __solaris__ (defined(__sun) || defined(__sun__) || defined(__SRV4) || defined(__srv4__))
#include "doomtype.h"
struct ticcmd_t;

View File

@ -5,7 +5,6 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/ucontext.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
@ -15,7 +14,7 @@
#ifndef PR_SET_PTRACER
#define PR_SET_PTRACER 0x59616d61
#endif
#elif defined (__APPLE__) || defined (__FreeBSD__)
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined(__OpenBSD__)
#include <signal.h>
#endif

View File

@ -241,7 +241,7 @@ void I_ClosestResolution (int *width, int *height, int bits)
EXTERN_CVAR(Int, vid_maxfps);
EXTERN_CVAR(Bool, cl_capfps);
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__OpenBSD__)
Semaphore FPSLimitSemaphore;
static void FPSLimitNotify(sigval val)
@ -334,8 +334,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewBits = DisplayBits;
setmodeneeded = true;
}

View File

@ -535,7 +535,7 @@ void SDLGLFB::NewRefreshRate ()
void SDLGLFB::SwapBuffers()
{
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__OpenBSD__)
if (vid_maxfps && !cl_capfps)
{
SEMAPHORE_WAIT(FPSLimitSemaphore)

View File

@ -227,7 +227,7 @@ void SDLFB::Update ()
DrawRateStuff ();
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__OpenBSD__)
if(vid_maxfps && !cl_capfps)
{
SEMAPHORE_WAIT(FPSLimitSemaphore)

View File

@ -39,7 +39,6 @@
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <wordexp.h>
#include "mus2midi.h"
extern void ChildSigHandler (int signum);
#endif

View File

@ -46,7 +46,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <wordexp.h>
#include <glob.h>
#include <signal.h>
int ChildQuit;
@ -523,15 +523,15 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
}
int forkres;
wordexp_t words = {};
glob_t glb;
switch (wordexp (CommandLine.GetChars(), &words, 0))
switch (glob (CommandLine.GetChars(), 0, NULL, &glb))
{
case 0: // all good
break;
case WRDE_NOSPACE:
wordfree (&words);
case GLOB_NOSPACE:
globfree (&glb);
default:
return false;
}
@ -546,7 +546,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
// freopen ("/dev/null", "w", stderr);
close (WavePipe[1]);
execvp (words.we_wordv[0], words.we_wordv);
execvp (glb.gl_pathv[0], glb.gl_pathv);
fprintf(stderr,"execvp failed\n");
_exit (0); // if execvp succeeds, we never get here
}
@ -567,7 +567,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
}*/
}
wordfree (&words);
globfree (&glb);
return ChildProcess != -1;
#endif // _WIN32
}

View File

@ -33,7 +33,7 @@
// HEADER FILES ------------------------------------------------------------
#if !defined(__FreeBSD__) && !defined(__APPLE__)
#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__OpenBSD__)
#include <malloc.h>
#else
#include <stdlib.h>