Add support for OpenBSD

This commit is contained in:
James Turner 2013-06-03 21:40:14 -04:00 committed by Lassi Kortela
parent c222226f43
commit 088ea8f194
5 changed files with 21 additions and 4 deletions

View File

@ -2305,6 +2305,8 @@ static void lisp_init(size_t initial_heapsize)
set(symbol("*os-name*"), symbol("win32")); set(symbol("*os-name*"), symbol("win32"));
#elif defined(MACOSX) #elif defined(MACOSX)
set(symbol("*os-name*"), symbol("macos")); set(symbol("*os-name*"), symbol("macos"));
#elif defined(OPENBSD)
set(symbol("*os-name*"), symbol("openbsd"));
#else #else
set(symbol("*os-name*"), symbol("unknown")); set(symbol("*os-name*"), symbol("unknown"));
#endif #endif

View File

@ -89,6 +89,12 @@ char *get_exename(char *buf, size_t size)
return buf; return buf;
} }
#elif defined(OPENBSD)
char *get_exename(char *buf, size_t size)
{
/* OpenBSD currently has no way of determining a processes pathname */
return NULL;
}
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
#include <sys/types.h> #include <sys/types.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>

View File

@ -21,12 +21,21 @@
# define LINUX # define LINUX
#elif defined(__APPLE__) && defined(__MACH__) #elif defined(__APPLE__) && defined(__MACH__)
# define MACOSX # define MACOSX
#elif defined(__OpenBSD__)
# define OPENBSD
#elif defined(_WIN32) #elif defined(_WIN32)
# define WIN32 # define WIN32
#else #else
# error "unknown platform" # error "unknown platform"
#endif #endif
#if defined(OPENBSD)
#if defined(__x86_64__)
# define __SIZEOF_POINTER__ 8
#else
# define __SIZEOF_POINTER__ 4
#endif
#endif
#if !defined (BITS32) && !defined (BITS64) #if !defined (BITS32) && !defined (BITS64)
#ifndef __SIZEOF_POINTER__ #ifndef __SIZEOF_POINTER__
@ -61,7 +70,7 @@
# define BIG_ENDIAN __BIG_ENDIAN # define BIG_ENDIAN __BIG_ENDIAN
# define PDP_ENDIAN __PDP_ENDIAN # define PDP_ENDIAN __PDP_ENDIAN
# define BYTE_ORDER __BYTE_ORDER # define BYTE_ORDER __BYTE_ORDER
#elif defined(MACOSX) #elif defined(MACOSX) || defined(OPENBSD)
# include <machine/endian.h> # include <machine/endian.h>
# define __LITTLE_ENDIAN LITTLE_ENDIAN # define __LITTLE_ENDIAN LITTLE_ENDIAN
# define __BIG_ENDIAN BIG_ENDIAN # define __BIG_ENDIAN BIG_ENDIAN

View File

@ -106,7 +106,7 @@ void timestring(double seconds, char *buffer, size_t len)
#endif #endif
} }
#if defined(LINUX) || defined(MACOSX) #if defined(LINUX) || defined(MACOSX) || defined(OPENBSD)
extern char *strptime(const char *s, const char *format, struct tm *tm); extern char *strptime(const char *s, const char *format, struct tm *tm);
double parsetime(const char *str) double parsetime(const char *str)
{ {

View File

@ -25,9 +25,9 @@
#include <malloc.h> #include <malloc.h>
#define snprintf _snprintf #define snprintf _snprintf
#else #else
#ifndef __FreeBSD__ #if !defined(__FreeBSD__) && !defined(__OpenBSD__)
#include <alloca.h> #include <alloca.h>
#endif /* __FreeBSD__ */ #endif /* __FreeBSD__ && __OpenBSD__ */
#endif #endif
#include <assert.h> #include <assert.h>