Skip to content

Commit 567dc5f

Browse files
authored
Merge pull request #113 from devnexen/netbsd_port
NetBSD support proposal.
2 parents 35c9e66 + 3d30544 commit 567dc5f

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ HUGE_PAGES =
193193
OS_FLAGS = -I/usr/local/cxx_atomics
194194
endif
195195

196+
ifeq ($(UNAME), NetBSD)
197+
STRIP = strip -s $(BUILD_DIR)/$(LIBNAME)
198+
HUGE_PAGES =
199+
endif
200+
196201
HOOKS = $(MALLOC_HOOK)
197202
OPTIMIZE = -O2 -fstrict-aliasing -Wstrict-aliasing
198203
COMMON_CFLAGS = -Wall -Iinclude/ $(THREAD_SUPPORT) $(PRE_POPULATE_PAGES) $(STARTUP_MEM_USAGE)

src/iso_alloc_random.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <Security/SecRandom.h>
1616
#elif __FreeBSD__ || __DragonFly__ || __linux__ || __ANDROID__
1717
#include <sys/random.h>
18+
#elif __NetBSD__
19+
#include <stdlib.h>
1820
#else
1921
#error "unknown OS"
2022
#endif
@@ -34,6 +36,10 @@ INTERNAL_HIDDEN uint64_t rand_uint64(void) {
3436
ret = SecRandomCopyBytes(kSecRandomDefault, sizeof(val), &val);
3537
#elif __FreeBSD__ || __DragonFly__ || __linux__ || __ANDROID__
3638
ret = getrandom(&val, sizeof(val), GRND_NONBLOCK) != sizeof(val);
39+
#elif __NetBSD__
40+
/* Temporary solution until NetBSD 10 released with getrandom support
41+
*/
42+
arc4random_buf(&val, sizeof(val));
3743
#endif
3844

3945
#if ABORT_NO_ENTROPY

0 commit comments

Comments
 (0)