Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add OpenBSD support #379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/math/math.h
Expand Up @@ -169,6 +169,7 @@ namespace embree

__forceinline int min(int a, int b) { return a<b ? a:b; }
__forceinline unsigned min(unsigned a, unsigned b) { return a<b ? a:b; }
__forceinline long min(long a, long b) { return a<b ? a:b; }
__forceinline int64_t min(int64_t a, int64_t b) { return a<b ? a:b; }
__forceinline float min(float a, float b) { return a<b ? a:b; }
__forceinline double min(double a, double b) { return a<b ? a:b; }
Expand All @@ -189,6 +190,7 @@ namespace embree

__forceinline int max(int a, int b) { return a<b ? b:a; }
__forceinline unsigned max(unsigned a, unsigned b) { return a<b ? b:a; }
__forceinline long max(long a, long b) { return a<b ? b:a; }
__forceinline int64_t max(int64_t a, int64_t b) { return a<b ? b:a; }
__forceinline float max(float a, float b) { return a<b ? b:a; }
__forceinline double max(double a, double b) { return a<b ? b:a; }
Expand Down
25 changes: 24 additions & 1 deletion common/sys/sysinfo.cpp
Expand Up @@ -574,6 +574,29 @@ namespace embree

#endif

////////////////////////////////////////////////////////////////////////////////
/// OpenBSD Platform
////////////////////////////////////////////////////////////////////////////////

#if defined(__OpenBSD__)
namespace embree
{
std::string getExecutableFileName()
{
/* not possible on OpenBSD. if you need it, save argv[0] */
return "";
}

size_t getVirtualMemoryBytes() {
return 0;
}

size_t getResidentMemoryBytes() {
return 0;
}
}
#endif

////////////////////////////////////////////////////////////////////////////////
/// Mac OS X Platform
////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -626,7 +649,7 @@ namespace embree
static int nThreads = -1;
if (nThreads != -1) return nThreads;

#if defined(__MACOSX__) || defined(__ANDROID__)
#if defined(__MACOSX__) || defined(__ANDROID__) || defined(__OpenBSD__)
nThreads = sysconf(_SC_NPROCESSORS_ONLN); // does not work in Linux LXC container
assert(nThreads);
#elif defined(__EMSCRIPTEN__)
Expand Down