mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
OpenBSD support
This commit is contained in:
parent
e42500c07a
commit
64e96c5f46
10 changed files with 23 additions and 21 deletions
|
@ -15,7 +15,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc/malloc.h>
|
#include <malloc/malloc.h>
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,14 +54,14 @@
|
||||||
#endif
|
#endif
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#define _msize(p) malloc_size(p)
|
#define _msize(p) malloc_size(p)
|
||||||
#elif defined(__sun)
|
#elif __solaris__ || defined(__OpenBSD__)
|
||||||
#define _msize(p) (*((size_t*)(p)-1))
|
#define _msize(p) (*((size_t*)(p)-1))
|
||||||
#elif !defined(_WIN32)
|
#elif !defined(_WIN32)
|
||||||
#define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD
|
#define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
#if !defined(__sun)
|
#if !__solaris__ && !defined(__OpenBSD__)
|
||||||
void *M_Malloc(size_t size)
|
void *M_Malloc(size_t size)
|
||||||
{
|
{
|
||||||
void *block = malloc(size);
|
void *block = malloc(size);
|
||||||
|
@ -129,7 +131,7 @@ void *M_Realloc(void *memblock, size_t size)
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__sun)
|
#if !__solaris__ && !defined(__OpenBSD__)
|
||||||
void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
|
void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
|
||||||
{
|
{
|
||||||
void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, 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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__sun)
|
#if !__solaris__ && !defined(__OpenBSD__)
|
||||||
void M_Free (void *block)
|
void M_Free (void *block)
|
||||||
{
|
{
|
||||||
if (block != NULL)
|
if (block != NULL)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#define __solaris__ (defined(__sun) || defined(__sun__) || defined(__SRV4) || defined(__srv4__))
|
||||||
|
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
|
||||||
struct ticcmd_t;
|
struct ticcmd_t;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/ucontext.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -15,7 +14,7 @@
|
||||||
#ifndef PR_SET_PTRACER
|
#ifndef PR_SET_PTRACER
|
||||||
#define PR_SET_PTRACER 0x59616d61
|
#define PR_SET_PTRACER 0x59616d61
|
||||||
#endif
|
#endif
|
||||||
#elif defined (__APPLE__) || defined (__FreeBSD__)
|
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined(__OpenBSD__)
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ void I_ClosestResolution (int *width, int *height, int bits)
|
||||||
EXTERN_CVAR(Int, vid_maxfps);
|
EXTERN_CVAR(Int, vid_maxfps);
|
||||||
EXTERN_CVAR(Bool, cl_capfps);
|
EXTERN_CVAR(Bool, cl_capfps);
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#if !defined(__APPLE__) && !defined(__OpenBSD__)
|
||||||
Semaphore FPSLimitSemaphore;
|
Semaphore FPSLimitSemaphore;
|
||||||
|
|
||||||
static void FPSLimitNotify(sigval val)
|
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)
|
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
NewWidth = screen->VideoWidth;
|
NewWidth = screen->GetWidth();
|
||||||
NewHeight = screen->VideoHeight;
|
NewHeight = screen->GetHeight();
|
||||||
NewBits = DisplayBits;
|
NewBits = DisplayBits;
|
||||||
setmodeneeded = true;
|
setmodeneeded = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,7 +535,7 @@ void SDLGLFB::NewRefreshRate ()
|
||||||
|
|
||||||
void SDLGLFB::SwapBuffers()
|
void SDLGLFB::SwapBuffers()
|
||||||
{
|
{
|
||||||
#ifndef __APPLE__
|
#if !defined(__APPLE__) && !defined(__OpenBSD__)
|
||||||
if (vid_maxfps && !cl_capfps)
|
if (vid_maxfps && !cl_capfps)
|
||||||
{
|
{
|
||||||
SEMAPHORE_WAIT(FPSLimitSemaphore)
|
SEMAPHORE_WAIT(FPSLimitSemaphore)
|
||||||
|
|
|
@ -227,7 +227,7 @@ void SDLFB::Update ()
|
||||||
|
|
||||||
DrawRateStuff ();
|
DrawRateStuff ();
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#if !defined(__APPLE__) && !defined(__OpenBSD__)
|
||||||
if(vid_maxfps && !cl_capfps)
|
if(vid_maxfps && !cl_capfps)
|
||||||
{
|
{
|
||||||
SEMAPHORE_WAIT(FPSLimitSemaphore)
|
SEMAPHORE_WAIT(FPSLimitSemaphore)
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wordexp.h>
|
|
||||||
#include "mus2midi.h"
|
#include "mus2midi.h"
|
||||||
extern void ChildSigHandler (int signum);
|
extern void ChildSigHandler (int signum);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <wordexp.h>
|
#include <glob.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
int ChildQuit;
|
int ChildQuit;
|
||||||
|
@ -523,15 +523,15 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int forkres;
|
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
|
case 0: // all good
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRDE_NOSPACE:
|
case GLOB_NOSPACE:
|
||||||
wordfree (&words);
|
globfree (&glb);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
|
||||||
// freopen ("/dev/null", "w", stderr);
|
// freopen ("/dev/null", "w", stderr);
|
||||||
close (WavePipe[1]);
|
close (WavePipe[1]);
|
||||||
|
|
||||||
execvp (words.we_wordv[0], words.we_wordv);
|
execvp (glb.gl_pathv[0], glb.gl_pathv);
|
||||||
fprintf(stderr,"execvp failed\n");
|
fprintf(stderr,"execvp failed\n");
|
||||||
_exit (0); // if execvp succeeds, we never get here
|
_exit (0); // if execvp succeeds, we never get here
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
wordfree (&words);
|
globfree (&glb);
|
||||||
return ChildProcess != -1;
|
return ChildProcess != -1;
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
// HEADER FILES ------------------------------------------------------------
|
// HEADER FILES ------------------------------------------------------------
|
||||||
|
|
||||||
#if !defined(__FreeBSD__) && !defined(__APPLE__)
|
#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__OpenBSD__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#else
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
Loading…
Reference in a new issue