mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 04:38:16 +00:00
Initial commit of NetBSD port
This commit is contained in:
+42
-1
@@ -83,6 +83,10 @@ extern "C" {
|
||||
#ifndef GB_SYSTEM_OPENBSD
|
||||
#define GB_SYSTEM_OPENBSD 1
|
||||
#endif
|
||||
#elif defined(__NetBSD__)
|
||||
#ifndef GB_SYSTEM_NETBSD
|
||||
#define GB_SYSTEM_NETBSD 1
|
||||
#endif
|
||||
#elif defined(__HAIKU__) || defined(__haiku__)
|
||||
#ifndef GB_SYSTEM_HAIKU
|
||||
#define GB_SYSTEM_HAIKU 1
|
||||
@@ -208,7 +212,7 @@ extern "C" {
|
||||
#endif
|
||||
#include <stdlib.h> // NOTE(bill): malloc on linux
|
||||
#include <sys/mman.h>
|
||||
#if !defined(GB_SYSTEM_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__HAIKU__)
|
||||
#if !defined(GB_SYSTEM_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__HAIKU__)
|
||||
#include <sys/sendfile.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
@@ -250,6 +254,11 @@ extern "C" {
|
||||
#define lseek64 lseek
|
||||
#endif
|
||||
|
||||
#if defined(GB_SYSTEM_NETBSD)
|
||||
#include <stdio.h>
|
||||
#define lseek64 lseek
|
||||
#endif
|
||||
|
||||
#if defined(GB_SYSTEM_HAIKU)
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
@@ -817,6 +826,13 @@ typedef struct gbAffinity {
|
||||
isize thread_count;
|
||||
isize threads_per_core;
|
||||
} gbAffinity;
|
||||
#elif defined(GB_SYSTEM_NETBSD)
|
||||
typedef struct gbAffinity {
|
||||
b32 is_accurate;
|
||||
isize core_count;
|
||||
isize thread_count;
|
||||
isize threads_per_core;
|
||||
} gbAffinity;
|
||||
#elif defined(GB_SYSTEM_HAIKU)
|
||||
typedef struct gbAffinity {
|
||||
b32 is_accurate;
|
||||
@@ -3267,6 +3283,31 @@ isize gb_affinity_thread_count_for_core(gbAffinity *a, isize core) {
|
||||
GB_ASSERT(0 <= core && core < a->core_count);
|
||||
return a->threads_per_core;
|
||||
}
|
||||
|
||||
#elif defined(GB_SYSTEM_NETBSD)
|
||||
#include <unistd.h>
|
||||
|
||||
void gb_affinity_init(gbAffinity *a) {
|
||||
a->core_count = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
a->threads_per_core = 1;
|
||||
a->is_accurate = a->core_count > 0;
|
||||
a->core_count = a->is_accurate ? a->core_count : 1;
|
||||
a->thread_count = a->core_count;
|
||||
}
|
||||
|
||||
void gb_affinity_destroy(gbAffinity *a) {
|
||||
gb_unused(a);
|
||||
}
|
||||
|
||||
b32 gb_affinity_set(gbAffinity *a, isize core, isize thread_index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
isize gb_affinity_thread_count_for_core(gbAffinity *a, isize core) {
|
||||
GB_ASSERT(0 <= core && core < a->core_count);
|
||||
return a->threads_per_core;
|
||||
}
|
||||
|
||||
#elif defined(GB_SYSTEM_HAIKU)
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user